public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/51143] New: [C++11][DR1159] Alias template allows class definition
@ 2011-11-15 19:35 daniel.kruegler at googlemail dot com
  2011-11-15 21:12 ` [Bug c++/51143] " jason at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: daniel.kruegler at googlemail dot com @ 2011-11-15 19:35 UTC (permalink / raw)
  To: gcc-bugs

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

             Bug #: 51143
           Summary: [C++11][DR1159] Alias template allows class definition
    Classification: Unclassified
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: daniel.kruegler@googlemail.com
                CC: jason@redhat.com


gcc 4.7.0 20111112 (experimental) in C++11 mode accepts the following program
(if variable a2 is commented out):

//---
template<int N>
using A1 = struct B1 { static auto constexpr value = N; };

A1<0> a1;

template<class T>
using A2 = struct B2 { void f(T){} };

A2<bool> a2; // Causes ICE

int main() { } // Line 11
//---

If a2 is commented in (as shown) an ICE is produced:

"main.cpp|11|internal compiler error: in is_base_type, at dwarf2out.c:9643"

According to 7.1.6 [dcl.type] p3 both alias template definitions should be
rejected:

"A type-specifier-seq shall not define a class or enumeration unless it
appears in the type-id of an alias-declaration (7.1.3) that is not the
declaration of a template-declaration."

This sentence was added to honor NB comment US 74 via:

http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#1159

The current implementation correctly rejects enumeration definitions and
unnamed class definitions, though.


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

end of thread, other threads:[~2011-11-22 16:43 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-11-15 19:35 [Bug c++/51143] New: [C++11][DR1159] Alias template allows class definition daniel.kruegler at googlemail dot com
2011-11-15 21:12 ` [Bug c++/51143] " jason at gcc dot gnu.org
2011-11-21 15:23 ` [Bug c++/51143] [C++11][DR 1159] " dodji at gcc dot gnu.org
2011-11-22 10:57 ` dodji at gcc dot gnu.org
2011-11-22 16:58 ` dodji at gcc dot gnu.org
2011-11-22 17:13 ` 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).