http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48457
Summary: [C++0x] GCC does not recognize function rvalue reference expressions as lvalues Product: gcc Version: 4.7.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassig...@gcc.gnu.org ReportedBy: daniel.krueg...@googlemail.com CC: ja...@redhat.com GCC 4.7.0 rejects the following code in C++0x mode: template<class T> T&& create(); template<class T, class Arg> void test() { T t(create<Arg>()); (void) t; } int main() { test<void(&)(), void()>(); } "error: invalid initialization of non-const reference of type 'void (&)()' from an rvalue of type 'void()'" This code should be well-formed, because the expression create<void()>(), which is a function call expression returning an rvalue reference of function type, is supposed to be an lvalue, not an xvalue. According to (N3242) 3.10 [basic.lval] and confirmed by 5 [expr] p. 6 there are only xvalues of object type and the semantics of above initialization is described by 8.5.3 [dcl.init.ref] p. 5 bullet 1, sub-bullet 1 where an lvalue-reference binds to an lvalue (of function type).