fork(1) download
  1. template<class Class, int Class::*dataMember>
  2. struct Reflect
  3. {
  4. operator int() {return 0;}
  5. };
  6.  
  7. class Foo
  8. {
  9. public:
  10. int bar = Reflect<Foo, &Foo::bar>{};
  11. };
  12.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp:10:26: error: extra qualification 'Foo::' on member 'bar' [-fpermissive]
  int bar = Reflect<Foo, &Foo::bar>{};
                          ^
prog.cpp:10:31: error: expected ';' at end of member declaration
  int bar = Reflect<Foo, &Foo::bar>{};
                               ^
prog.cpp:10:31: error: redeclaration of 'int& Foo::bar'
prog.cpp:10:31: note: previous declaration 'int Foo::bar'
prog.cpp:10:34: error: expected unqualified-id before '>' token
  int bar = Reflect<Foo, &Foo::bar>{};
                                  ^
prog.cpp:10:20: error: wrong number of template arguments (1, should be 2)
  int bar = Reflect<Foo, &Foo::bar>{};
                    ^
prog.cpp:2:8: error: provided for 'template<class Class, int Class::* dataMember> struct Reflect'
 struct Reflect
        ^
stdout
Standard output is empty