public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/14008] New: Confusing diagnostic when ommitting a template parameter
@ 2004-02-03 20:29 reichelt at gcc dot gnu dot org
  2004-02-03 20:33 ` [Bug c++/14008] [3.4/3.5 Regression] " pinskia at gcc dot gnu dot org
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: reichelt at gcc dot gnu dot org @ 2004-02-03 20:29 UTC (permalink / raw)
  To: gcc-bugs

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


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2004-06-12 21:49 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-02-03 20:29 [Bug c++/14008] New: Confusing diagnostic when ommitting a template parameter reichelt at gcc dot gnu dot org
2004-02-03 20:33 ` [Bug c++/14008] [3.4/3.5 Regression] " pinskia at gcc dot gnu dot org
2004-02-04  3:25 ` giovannibajo at libero dot it
2004-02-05  1:17 ` giovannibajo at libero dot it
2004-02-05  1:20 ` pinskia at gcc dot gnu dot org
2004-02-05  7:07 ` steven at gcc dot gnu dot org
2004-02-05 16:49 ` cvs-commit at gcc dot gnu dot org
2004-02-05 16:51 ` cvs-commit at gcc dot gnu dot org
2004-02-05 16:55 ` giovannibajo at libero dot it
2004-06-12 21:49 ` [Bug c++/14008] [3.4 Regression] Confusing diagnostic when omitting " mmitchel at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).