The code:
void grab(int& i);

int main(void)
{ grab(1); }

Produces the useful and informative error:

invalid initialization of non-const reference of type ‘int&’ from a temporary
of type ‘int’

Whereas the code:


template<typename T>
void grab(T t, int& i);

int main(void)
{ grab(1,1); }

Produces the much less useful

"no matching function for call to ‘grab(int, int)’"

Would it be possible to still get the error message about temporaries in the
templated case?


-- 
           Summary: Poor error message
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: chris at bubblescope dot net


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

Reply via email to