#include <iostream> using namespace std; template <typename T>void foo(T&& x) { x.func(); } int main(){ auto bar = &foo<int>;}
Standard input is empty
prog.cpp: In instantiation of 'void foo(T&&) [with T = int]': prog.cpp:10:14: required from here prog.cpp:6:19: error: request for member 'func' in 'x', which is of non-class type 'int' void foo(T&& x) { x.func(); } ^
Standard output is empty
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!