fork download
  1. class Base { /* ... */ };
  2. class Derived : public base { /* ... */ };
  3.  
  4. template <class T>
  5. class Mixin : public T { /* ... */ };
  6.  
  7. int main()
  8. {
  9. Base b;
  10. Derived d;
  11.  
  12. Mixin<Base> mb;
  13. Mixin<Derived> md;
  14.  
  15. b = d // ok
  16. mb = md; // syntax error
  17. return 0;
  18. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp:2:29: error: expected class-name before '{' token
 class Derived : public base { /* ... */ };
                             ^
prog.cpp: In function 'int main()':
prog.cpp:15:5: error: no match for 'operator=' (operand types are 'Base' and 'Derived')
  b  = d          // ok
     ^
prog.cpp:15:5: note: candidate is:
prog.cpp:1:7: note: Base& Base::operator=(const Base&)
 class Base { /* ... */ };
       ^
prog.cpp:1:7: note:   no known conversion for argument 1 from 'Derived' to 'const Base&'
stdout
Standard output is empty