#include <iostream> struct A { static constexpr int foo() { return 1; } }; template <class T> void bar(T&& t) { T::foo(); // <-- error } int main() { A a; bar(a); }
Standard input is empty
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 ~~~~~~^~
Standard output is empty