fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. struct xyz {
  5. int i;
  6. int j;
  7. };
  8.  
  9. void print(xyz arg)
  10. {
  11. std::cout << arg.i << ' ' << arg.j << endl;
  12. }
  13.  
  14. int main() {
  15. auto wtf = {.i = 1, .j = 2};
  16. print((struct xyz)wtf);
  17. return 0;
  18. }
Compilation error #stdin compilation error #stdout 0s 15232KB
stdin
Standard input is empty
compilation info
prog.cpp: In function ‘int main()’:
prog.cpp:16:20: error: no matching function for call to ‘xyz::xyz(std::initializer_list<int>&)’
  print((struct xyz)wtf);
                    ^~~
prog.cpp:4:8: note: candidate: xyz::xyz()
 struct xyz {
        ^~~
prog.cpp:4:8: note:   candidate expects 0 arguments, 1 provided
prog.cpp:4:8: note: candidate: constexpr xyz::xyz(const xyz&)
prog.cpp:4:8: note:   no known conversion for argument 1 from ‘std::initializer_list<int>’ to ‘const xyz&’
prog.cpp:4:8: note: candidate: constexpr xyz::xyz(xyz&&)
prog.cpp:4:8: note:   no known conversion for argument 1 from ‘std::initializer_list<int>’ to ‘xyz&&’
stdout
Standard output is empty