This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/70448] New: ICE on invalid code on x86_64-linux-gnu: unexpected expression âfâ of kind overload
- From: "su at cs dot ucdavis.edu" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 30 Mar 2016 06:39:27 +0000
- Subject: [Bug c++/70448] New: ICE on invalid code on x86_64-linux-gnu: unexpected expression âfâ of kind overload
- Auto-submitted: auto-generated
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70448
Bug ID: 70448
Summary: ICE on invalid code on x86_64-linux-gnu: unexpected
expression âfâ of kind overload
Product: gcc
Version: 6.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: su at cs dot ucdavis.edu
Target Milestone: ---
The following causes an ICE when compiled with the current GCC trunk on
x86_64-linux-gnu in both 32-bit and 64-bit modes.
This is a regression from 5.3.x.
$ g++-trunk -v
Using built-in specs.
COLLECT_GCC=g++-trunk
COLLECT_LTO_WRAPPER=/usr/local/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/6.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-source-trunk/configure --enable-languages=c,c++,lto
--prefix=/usr/local/gcc-trunk --disable-bootstrap
Thread model: posix
gcc version 6.0.0 20160329 (experimental) [trunk revision 234516] (GCC)
$
$ g++-5.3 small.cpp
small.cpp: In function âvoid f()â:
small.cpp:4:16: error: âf()â cannot appear in a constant-expression
enum E { a = f };
^
$
$ g++-trunk small.cpp
small.cpp: In instantiation of âvoid f() [with int I = 0]â:
small.cpp:10:10: required from here
small.cpp:4:8: internal compiler error: unexpected expression âfâ of kind
overload
enum E { a = f };
^
0x84f300 cxx_eval_constant_expression
../../gcc-source-trunk/gcc/cp/constexpr.c:3930
0x853c19 cxx_eval_outermost_constant_expr
../../gcc-source-trunk/gcc/cp/constexpr.c:3988
0x649997 build_enumerator(tree_node*, tree_node*, tree_node*, tree_node*,
unsigned int)
../../gcc-source-trunk/gcc/cp/decl.c:13518
0x6a4e76 tsubst_enum
../../gcc-source-trunk/gcc/cp/pt.c:22339
0x6a4e76 lookup_template_class_1
../../gcc-source-trunk/gcc/cp/pt.c:8614
0x6a4e76 lookup_template_class(tree_node*, tree_node*, tree_node*, tree_node*,
int, int)
../../gcc-source-trunk/gcc/cp/pt.c:8640
0x6a78fb tsubst_aggr_type
../../gcc-source-trunk/gcc/cp/pt.c:11426
0x68f5a7 tsubst(tree_node*, tree_node*, int, tree_node*)
../../gcc-source-trunk/gcc/cp/pt.c:12896
0x699225 tsubst_decl
../../gcc-source-trunk/gcc/cp/pt.c:12225
0x68f9ae tsubst(tree_node*, tree_node*, int, tree_node*)
../../gcc-source-trunk/gcc/cp/pt.c:12817
0x67e6a0 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
../../gcc-source-trunk/gcc/cp/pt.c:15161
0x67d493 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
../../gcc-source-trunk/gcc/cp/pt.c:15104
0x67efb0 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
../../gcc-source-trunk/gcc/cp/pt.c:15290
0x67b608 instantiate_decl(tree_node*, int, bool)
../../gcc-source-trunk/gcc/cp/pt.c:22013
0x6c79b2 instantiate_pending_templates(int)
../../gcc-source-trunk/gcc/cp/pt.c:22132
0x70a337 c_parse_final_cleanups()
../../gcc-source-trunk/gcc/cp/decl2.c:4599
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.
$
----------------------------
template <int I>
void f ()
{
enum E { a = f };
}
int
main ()
{
f <0> ();
return 0;
}