This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/14008] New: Confusing diagnostic when ommitting a template parameter


Here are two invalid code snippets where gcc gives misleading diagnostic:

=================================================
namespace N
{ 
    template<int> struct A {};
}

struct B
{
    N::A a;
};
=================================================

With mainline I get

bug1.cc:8: error: using-declaration for non-member at class scope
bug1.cc:8: error: expected `;' before "a"

but I fail to see a using declaration in the code.


If I write "typename N::A a;" instead and make "struct B" a template
like so

=================================================
namespace N
{ 
    template<int> struct A {};
}

template<int> struct B
{
    typename N::A a;
};
=================================================

I get

bug2.cc:8: error: no class template named `A' in `N'
bug2.cc:8: error: ISO C++ forbids declaration of `a' with no type

which is equally confusing, since 'A' *is* a class template in 'N'.

-- 
           Summary: Confusing diagnostic when ommitting a template parameter
           Product: gcc
           Version: 3.4.0
            Status: UNCONFIRMED
          Keywords: diagnostic
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: reichelt at gcc dot gnu dot org
                CC: gcc-bugs at gcc dot gnu dot org


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]