fork(7) download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. template<typename T>
  5. union u {
  6. T a;
  7. char b;
  8. u(T aa) : a(aa) {}
  9. };
  10.  
  11. template<typename T>
  12. u<T> make_u(T t) {
  13. return {t};
  14. }
  15.  
  16. int main() {
  17. std::cout << make_u<int>(1).a;
  18. }
Success #stdin #stdout 0s 2884KB
stdin
Standard input is empty
stdout
1