fork(2) download
  1. #include <iostream>
  2.  
  3. struct A
  4. {
  5. static constexpr int foo() { return 1; }
  6. };
  7.  
  8. template <class T>
  9. void bar(T&& t)
  10. {
  11. T::foo(); // <-- error
  12. }
  13.  
  14. int main()
  15. {
  16. A a;
  17. bar(a);
  18. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In instantiation of ‘void bar(T&&) [with T = A&]’:
prog.cpp:17:10:   required from here
prog.cpp:11:11: error: ‘foo’ is not a member of ‘A&’
     T::foo(); // <-- error
     ~~~~~~^~
stdout
Standard output is empty