This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/14008] New: Confusing diagnostic when ommitting a template parameter
- From: "reichelt at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 3 Feb 2004 20:29:42 -0000
- Subject: [Bug c++/14008] New: Confusing diagnostic when ommitting a template parameter
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
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