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

* [Bug c++/51143] [C++11][DR1159] Alias template allows class definition
  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 ` jason at gcc dot gnu.org
  2011-11-21 15:23 ` [Bug c++/51143] [C++11][DR 1159] " dodji at gcc dot gnu.org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: jason at gcc dot gnu.org @ 2011-11-15 21:12 UTC (permalink / raw)
  To: gcc-bugs

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

Jason Merrill <jason at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|jason at redhat dot com     |dodji at gcc dot gnu.org,
                   |                            |jason at gcc dot gnu.org

--- Comment #1 from Jason Merrill <jason at gcc dot gnu.org> 2011-11-15 20:32:02 UTC ---
Also, please use jason@gcc.gnu.org for me in Bugzilla, thanks.


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

* [Bug c++/51143] [C++11][DR 1159] Alias template allows class definition
  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 ` dodji at gcc dot gnu.org
  2011-11-22 10:57 ` dodji at gcc dot gnu.org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: dodji at gcc dot gnu.org @ 2011-11-21 15:23 UTC (permalink / raw)
  To: gcc-bugs

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

Dodji Seketeli <dodji at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |ASSIGNED
   Last reconfirmed|                            |2011-11-21
         AssignedTo|unassigned at gcc dot       |dodji at gcc dot gnu.org
                   |gnu.org                     |
     Ever Confirmed|0                           |1


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

* [Bug c++/51143] [C++11][DR 1159] Alias template allows class definition
  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
  4 siblings, 0 replies; 6+ messages in thread
From: dodji at gcc dot gnu.org @ 2011-11-22 10:57 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Dodji Seketeli <dodji at gcc dot gnu.org> 2011-11-22 09:49:12 UTC ---
A candidate fix has been posted to
http://gcc.gnu.org/ml/gcc-patches/2011-11/msg02194.html.


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

* [Bug c++/51143] [C++11][DR 1159] Alias template allows class definition
  2011-11-15 19:35 [Bug c++/51143] New: [C++11][DR1159] Alias template allows class definition daniel.kruegler at googlemail dot com
                   ` (2 preceding siblings ...)
  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
  4 siblings, 0 replies; 6+ messages in thread
From: dodji at gcc dot gnu.org @ 2011-11-22 16:58 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Dodji Seketeli <dodji at gcc dot gnu.org> 2011-11-22 16:41:18 UTC ---
Author: dodji
Date: Tue Nov 22 16:41:10 2011
New Revision: 181626

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=181626
Log:
PR c++/51143 - Alias template allows class definition

gcc/cp

    PR c++/51143
    * parser.c (cp_parser_alias_declaration): Don't allow type
    definition in templates.

gcc/testsuite

    PR c++/51143
    * g++.dg/cpp0x/alias-decl-16.C: New test.

Added:
    trunk/gcc/testsuite/g++.dg/cpp0x/alias-decl-16.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/parser.c
    trunk/gcc/testsuite/ChangeLog


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

* [Bug c++/51143] [C++11][DR 1159] Alias template allows class definition
  2011-11-15 19:35 [Bug c++/51143] New: [C++11][DR1159] Alias template allows class definition daniel.kruegler at googlemail dot com
                   ` (3 preceding siblings ...)
  2011-11-22 16:58 ` dodji at gcc dot gnu.org
@ 2011-11-22 17:13 ` dodji at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: dodji at gcc dot gnu.org @ 2011-11-22 17:13 UTC (permalink / raw)
  To: gcc-bugs

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

Dodji Seketeli <dodji at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED

--- Comment #4 from Dodji Seketeli <dodji at gcc dot gnu.org> 2011-11-22 16:42:11 UTC ---
This should be fixed in trunk (4.7) now.


^ 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).