[Bug c++/52851] New: auto&& fails to deduce type in function template

delong.j at fb dot com gcc-bugzilla@gcc.gnu.org
Tue Apr 3 18:55:00 GMT 2012


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52851

             Bug #: 52851
           Summary: auto&& fails to deduce type in function template
    Classification: Unclassified
           Product: gcc
           Version: 4.6.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: delong.j@fb.com


// Code snippet:

struct C { int var; };

template<class T> void func(C* x) {
  // error: invalid initialization of reference of type ‘int&&’ from expression
of type ‘int’
  auto&& foo = x->var;
}

int main() { func<int>(new C); }



More information about the Gcc-bugs mailing list