fork download
  1. #include <initializer_list>
  2.  
  3. class A {
  4. public:
  5. A(const A&nocopy) = delete;
  6. A&operator=(const A&nocopy) = delete;
  7. A(const std::initializer_list<int>& rhs) {}
  8. };
  9.  
  10. int main() {
  11. A a{ 2, 3, 5, 7};
  12. A b( { 2, 3, 5, 7} );
  13. A c = { 2, 3, 5, 7};
  14. A d = A{ 2, 3, 5, 7};
  15. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In function 'int main()':
prog.cpp:5:4: error: deleted function 'A::A(const A&)'
prog.cpp:13:23: error: used here
prog.cpp:5:4: error: deleted function 'A::A(const A&)'
prog.cpp:14:24: error: used here
stdout
Standard output is empty