c++/10618: [diagnostic] Error message for function declarations with invalid return type could be improved

Giovanni Bajo giovannibajo@libero.it
Mon May 5 10:27:00 GMT 2003


http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=10618

I add the following snippet to this PR (was c++/9175), since it's a very
similar situation:

------------------------------------------------------------------
template <class>
struct Foo
{
    typedef int int_type;
};


template <class T>
Foo<T>::int_type<T> func1(Foo<T>::int_type c)
{}

template <class T>
Foo<T>::template int_type<T> func2(Foo<T>::int_type c)
{}
------------------------------------------------------------------
pr9175.cpp:9: error: expected function-definition
pr9175.cpp:13: error: expected function-definition


FYI, Comeau gives:

"pr9175.cpp", line 9: error: type "Foo<<unnamed>>::int_type" may not have a
          template argument list
  Foo<T>::int_type<T> func1(Foo<T>::int_type c)
          ^

"pr9175.cpp", line 9: error: nontype
          "Foo<<unnamed>>::int_type [with <unnamed>=T]" is not a template
  Foo<T>::int_type<T> func1(Foo<T>::int_type c)
          ^

"pr9175.cpp", line 9: error: nontype
          "Foo<<unnamed>>::int_type [with <unnamed>=T]" is not a type name
  Foo<T>::int_type<T> func1(Foo<T>::int_type c)
                            ^

"pr9175.cpp", line 13: warning: name following "template" must be a member
          template
  Foo<T>::template int_type<T> func2(Foo<T>::int_type c)
                   ^


"pr9175.cpp", line 13: error: type "Foo<<unnamed>>::int_type" may not have a
          template argument list
  Foo<T>::template int_type<T> func2(Foo<T>::int_type c)
                   ^

"pr9175.cpp", line 13: error: template
          "Foo<<unnamed>>::int_type [with <unnamed>=T]" is not a type name
  Foo<T>::template int_type<T> func2(Foo<T>::int_type c)
  ^

"pr9175.cpp", line 13: error: nontype
          "Foo<<unnamed>>::int_type [with <unnamed>=T]" is not a type name
  Foo<T>::template int_type<T> func2(Foo<T>::int_type c)
                                     ^


Giovanni Bajo



More information about the Gcc-bugs mailing list