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

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