https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65406

            Bug ID: 65406
           Summary: Wrong namespace in error message for missing
                    "typename" in lambda parameter type list
           Product: gcc
           Version: 4.9.1
            Status: UNCONFIRMED
          Severity: minor
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: arvo at me dot com

Simplified source (compile with -std=c++11):

namespace not_here
{
template<typename T>
struct Buzz;
} // namespace not_here

namespace here
{
template<typename T>
struct Foo
{
    typedef not_here::Buzz<T> Bar;

    void bad_error();
};
} // namespace here

template<typename T>
void here::Foo<T>::bad_error()
{
    [](/*typename*/ Bar::type){};
}


This produces the following error message:
missing_typename_bad_error.cxx: In member function ‘void
here::Foo<T>::bad_error()’:
missing_typename_bad_error.cxx:21:26: error: ‘not_here::Bar<T>::type’ is not a
type
     [](/*typename*/ Bar::type){};

Note that the qualified name for Bar is "here::Foo<T>::Bar" and not
"not_here::Bar". Also, Bar is not a template. So far I have only been able to
reproduce this with a parameter-type-list in a lambda expression, more logical
and helpful error messages are given e.g. for parameter-type-lists for function
types and for the attempt to create a local variable.

Observed in GCC 4.8.1 and 4.9.1 on openSUSE 13.1 (x86_64)

Reply via email to