fork download
  1. struct A {
  2. const int j;
  3. virtual void foo() {}
  4. };
  5.  
  6. int main() {
  7. //A a{};
  8. A * aa = new A();
  9. return 0;
  10. }
Compilation error #stdin compilation error #stdout 0s 3424KB
stdin
Standard input is empty
compilation info
prog.cpp:2:12: warning: non-static const member ‘const int A::j’ in class without a constructor [-Wuninitialized]
  const int j;
            ^
prog.cpp: In function ‘int main()’:
prog.cpp:8:17: error: use of deleted function ‘A::A()’
  A * aa = new A();
                 ^
prog.cpp:1:8: note: ‘A::A()’ is implicitly deleted because the default definition would be ill-formed:
 struct A {
        ^
prog.cpp:1:8: error: uninitialized non-static const member ‘const int A::j’
prog.cpp:8:6: warning: unused variable ‘aa’ [-Wunused-variable]
  A * aa = new A();
      ^
stdout
Standard output is empty