fork(1) download
  1. class Foo {
  2. int a;
  3. public:
  4. Foo(int i) : a(i) {}
  5. template<typename T>
  6. auto foo() -> decltype(a) {
  7. return a;
  8. }
  9. auto foo() -> decltype(a) {
  10. return a;
  11. }
  12. };
  13.  
  14. int main() {
  15. Foo f(0);
  16. f.foo(); // works fine
  17. f.foo<float>(); // error
  18. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In function 'int main()':
prog.cpp:2:9: error: 'int Foo::a' is private
prog.cpp:17:18: error: within this context
prog.cpp:2:9: error: 'int Foo::a' is private
prog.cpp:17:18: error: within this context
stdout

Standard output is empty