public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/54401] New: Missing diagnostics about type-alias at class scope
@ 2012-08-29  8:37 gdr at gcc dot gnu.org
  2012-08-29  8:40 ` [Bug c++/54401] " gdr at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: gdr at gcc dot gnu.org @ 2012-08-29  8:37 UTC (permalink / raw)
  To: gcc-bugs

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

             Bug #: 54401
           Summary: Missing diagnostics about type-alias at class scope
    Classification: Unclassified
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Severity: major
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: gdr@gcc.gnu.org


The following simple and innocuous (ill-formed)
programs leads g++ in C++11 mode to produce a
very misleading unhelpful diagnostic:

gauss[3:28]% cat b.C                                                
template<typename>
struct X {
   using type = T;
};

When compiled with g++ in C++11 mode, I get:

gauss[3:32]% ~/gnu/bin/g++ -std=c++11 b.C                     
b.C:3:10: error: expected nested-name-specifier before 'type'
    using type = T;
          ^
b.C:3:10: error: using-declaration for non-member at class scope
b.C:3:15: error: expected ';' before '=' token
    using type = T;
               ^
b.C:3:15: error: expected unqualified-id before '=' token


(you need monospace fonts to make sense of the carets in the diagnostics)

The real problem is that `T' is undeclared (presumably a template
type parameter.)  

I would expect the compiler to accept the syntax as a valid 
alias declaration, and complain later that `T' isn't in scope.
In short it should be semantics error, not a parse error.


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

end of thread, other threads:[~2012-12-07 17:15 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-08-29  8:37 [Bug c++/54401] New: Missing diagnostics about type-alias at class scope gdr at gcc dot gnu.org
2012-08-29  8:40 ` [Bug c++/54401] " gdr at gcc dot gnu.org
2012-09-21 14:14 ` dodji at gcc dot gnu.org
2012-09-28 15:43 ` dodji at seketeli dot org
2012-12-07 17:06 ` dodji at gcc dot gnu.org
2012-12-07 17:15 ` dodji at gcc dot gnu.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).