public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/58649] New: [4.7/4.8/4.9 Regression] ICE with use of enum before declaration
@ 2013-10-06 21:05 reichelt at gcc dot gnu.org
  2013-10-10 11:56 ` [Bug c++/58649] " rguenth at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: reichelt at gcc dot gnu.org @ 2013-10-06 21:05 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 58649
           Summary: [4.7/4.8/4.9 Regression] ICE with use of enum before
                    declaration
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: reichelt at gcc dot gnu.org

The following invalid code snippet triggers an ICE since GCC 4.2.0:

====================================
template<typename> void foo()
{
  E();
  enum E {};
}

template void foo<int>();
====================================

bug.cc: In function 'void foo()':
bug.cc:3:5: error: there are no arguments to 'E' that depend on a template
parameter, so a declaration of 'E' must be available [-fpermissive]
   E();
     ^
bug.cc:3:5: note: (if you use '-fpermissive', G++ will accept your code, but
allowing the use of an undeclared name is deprecated)
bug.cc: In instantiation of 'void foo() [with <template-parameter-1-1> = int]':
bug.cc:7:24:   required from here
bug.cc:3:5: error: 'E' was not declared in this scope
bug.cc:4:8: internal compiler error: tree check: expected enumeral_type, have
error_mark in lookup_template_class_1, at cp/pt.c:7479
   enum E {};
        ^
0xcd860a tree_check_failed(tree_node const*, char const*, int, char const*,
...)
        ../../gcc/gcc/tree.c:9176
0x5b3e5d tree_check
        ../../gcc/gcc/tree.h:2609
0x5b3e5d lookup_template_class_1
        ../../gcc/gcc/cp/pt.c:7479
0x5b3e5d lookup_template_class(tree_node*, tree_node*, tree_node*, tree_node*,
int, int)
        ../../gcc/gcc/cp/pt.c:7695
0x5b894e tsubst_aggr_type
        ../../gcc/gcc/cp/pt.c:9977
0x5ac34b tsubst(tree_node*, tree_node*, int, tree_node*)
        ../../gcc/gcc/cp/pt.c:11367
0x5bd413 tsubst_decl
        ../../gcc/gcc/cp/pt.c:10752
0x5ac895 tsubst(tree_node*, tree_node*, int, tree_node*)
        ../../gcc/gcc/cp/pt.c:11288
0x5a208c tsubst_expr
        ../../gcc/gcc/cp/pt.c:13148
0x5a1643 tsubst_expr
        ../../gcc/gcc/cp/pt.c:13091
0x5a2421 tsubst_expr
        ../../gcc/gcc/cp/pt.c:13287
0x59fdbf instantiate_decl(tree_node*, int, bool)
        ../../gcc/gcc/cp/pt.c:19394
0x5dc61f instantiate_pending_templates(int)
        ../../gcc/gcc/cp/pt.c:19495
0x617896 cp_write_global_declarations()
        ../../gcc/gcc/cp/decl2.c:4065
Please submit a full bug report, [etc.]


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

* [Bug c++/58649] [4.7/4.8/4.9 Regression] ICE with use of enum before declaration
  2013-10-06 21:05 [Bug c++/58649] New: [4.7/4.8/4.9 Regression] ICE with use of enum before declaration reichelt at gcc dot gnu.org
@ 2013-10-10 11:56 ` rguenth at gcc dot gnu.org
  2014-01-30 11:49 ` paolo.carlini at oracle dot com
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: rguenth at gcc dot gnu.org @ 2013-10-10 11:56 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P5
   Target Milestone|---                         |4.7.4


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

* [Bug c++/58649] [4.7/4.8/4.9 Regression] ICE with use of enum before declaration
  2013-10-06 21:05 [Bug c++/58649] New: [4.7/4.8/4.9 Regression] ICE with use of enum before declaration reichelt at gcc dot gnu.org
  2013-10-10 11:56 ` [Bug c++/58649] " rguenth at gcc dot gnu.org
@ 2014-01-30 11:49 ` paolo.carlini at oracle dot com
  2014-01-30 14:29 ` paolo at gcc dot gnu.org
  2014-01-30 14:30 ` [Bug c++/58649] [4.7/4.8 " paolo.carlini at oracle dot com
  3 siblings, 0 replies; 5+ messages in thread
From: paolo.carlini at oracle dot com @ 2014-01-30 11:49 UTC (permalink / raw)
  To: gcc-bugs

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

Paolo Carlini <paolo.carlini at oracle dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |ASSIGNED
   Last reconfirmed|                            |2014-01-30
           Assignee|unassigned at gcc dot gnu.org      |paolo.carlini at oracle dot com
     Ever confirmed|0                           |1

--- Comment #1 from Paolo Carlini <paolo.carlini at oracle dot com> ---
Mine.


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

* [Bug c++/58649] [4.7/4.8/4.9 Regression] ICE with use of enum before declaration
  2013-10-06 21:05 [Bug c++/58649] New: [4.7/4.8/4.9 Regression] ICE with use of enum before declaration reichelt at gcc dot gnu.org
  2013-10-10 11:56 ` [Bug c++/58649] " rguenth at gcc dot gnu.org
  2014-01-30 11:49 ` paolo.carlini at oracle dot com
@ 2014-01-30 14:29 ` paolo at gcc dot gnu.org
  2014-01-30 14:30 ` [Bug c++/58649] [4.7/4.8 " paolo.carlini at oracle dot com
  3 siblings, 0 replies; 5+ messages in thread
From: paolo at gcc dot gnu.org @ 2014-01-30 14:29 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from paolo at gcc dot gnu.org <paolo at gcc dot gnu.org> ---
Author: paolo
Date: Thu Jan 30 14:28:55 2014
New Revision: 207304

URL: http://gcc.gnu.org/viewcvs?rev=207304&root=gcc&view=rev
Log:
/cp
2014-01-30  Paolo Carlini  <paolo.carlini@oracle.com>

    PR c++/58649
    * pt.c (lookup_template_class_1): Check start_enum return value
    for error_mark_node.

/testsuite
2014-01-30  Paolo Carlini  <paolo.carlini@oracle.com>

    PR c++/58649
    * g++.dg/template/crash117.C: New.

Added:
    trunk/gcc/testsuite/g++.dg/template/crash117.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/pt.c
    trunk/gcc/testsuite/ChangeLog


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

* [Bug c++/58649] [4.7/4.8 Regression] ICE with use of enum before declaration
  2013-10-06 21:05 [Bug c++/58649] New: [4.7/4.8/4.9 Regression] ICE with use of enum before declaration reichelt at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2014-01-30 14:29 ` paolo at gcc dot gnu.org
@ 2014-01-30 14:30 ` paolo.carlini at oracle dot com
  3 siblings, 0 replies; 5+ messages in thread
From: paolo.carlini at oracle dot com @ 2014-01-30 14:30 UTC (permalink / raw)
  To: gcc-bugs

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

Paolo Carlini <paolo.carlini at oracle dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED
           Assignee|paolo.carlini at oracle dot com    |unassigned at gcc dot gnu.org
   Target Milestone|4.7.4                       |4.9.0
            Summary|[4.7/4.8/4.9 Regression]    |[4.7/4.8 Regression] ICE
                   |ICE with use of enum before |with use of enum before
                   |declaration                 |declaration

--- Comment #3 from Paolo Carlini <paolo.carlini at oracle dot com> ---
Fixed for 4.9.0.


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

end of thread, other threads:[~2014-01-30 14:30 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-10-06 21:05 [Bug c++/58649] New: [4.7/4.8/4.9 Regression] ICE with use of enum before declaration reichelt at gcc dot gnu.org
2013-10-10 11:56 ` [Bug c++/58649] " rguenth at gcc dot gnu.org
2014-01-30 11:49 ` paolo.carlini at oracle dot com
2014-01-30 14:29 ` paolo at gcc dot gnu.org
2014-01-30 14:30 ` [Bug c++/58649] [4.7/4.8 " paolo.carlini at oracle dot com

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