[Bug c++/83825] New: ICE on invalid C++ code with shadowed identifiers: in operator[], at vec.h:826
su at cs dot ucdavis.edu
gcc-bugzilla@gcc.gnu.org
Sat Jan 13 05:22:00 GMT 2018
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83825
Bug ID: 83825
Summary: ICE on invalid C++ code with shadowed identifiers: in
operator[], at vec.h:826
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: su at cs dot ucdavis.edu
Target Milestone: ---
This appears to be a recent regression.
$ g++tk -v
Using built-in specs.
COLLECT_GCC=g++tk
COLLECT_LTO_WRAPPER=/home/su/software/tmp/gcc/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/8.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-source-trunk/configure --enable-languages=c,c++,lto
--prefix=/home/su/software/tmp/gcc/gcc-trunk --disable-bootstrap
Thread model: posix
gcc version 8.0.0 20180112 (experimental) [trunk revision 256599] (GCC)
$
$ g++-7.2.0 -c tmp.cpp
tmp.cpp:1:26: error: declaration of ‘template<int A> struct A’ shadows template
parameter
template < int A > class A {};
^
tmp.cpp:1:12: note: template parameter ‘A’ declared here
template < int A > class A {};
^~~
$
$ g++tk -c tmp.cpp
tmp.cpp:1:26: error: declaration of ‘template<int A> struct A’ shadows template
parameter
template < int A > class A {};
^
tmp.cpp:1:12: note: template parameter ‘A’ declared here
template < int A > class A {};
^~~
tmp.cpp: In instantiation of ‘void B<I>::f() [with int I = 0]’:
tmp.cpp:11:27: required from here
tmp.cpp:7:13: internal compiler error: in operator[], at vec.h:826
A < I > a;
^
0x601912 vec<tree_node*, va_gc, vl_embed>::operator[](unsigned int)
../../gcc-source-trunk/gcc/vec.h:826
0x7d5e88 vec<tree_node*, va_gc, vl_embed>::operator[](unsigned int)
../../gcc-source-trunk/gcc/vec.h:970
0x7d5e88 member_vec_dedup
../../gcc-source-trunk/gcc/cp/name-lookup.c:1600
0x7d6490 get_member_slot(tree_node*, tree_node*)
../../gcc-source-trunk/gcc/cp/name-lookup.c:1357
0x6d4d35 add_method(tree_node*, tree_node*, bool)
../../gcc-source-trunk/gcc/cp/class.c:1015
0x7cd97b lazily_declare_fn(special_function_kind, tree_node*)
../../gcc-source-trunk/gcc/cp/method.c:2399
0x7d590c get_class_binding(tree_node*, tree_node*, int)
../../gcc-source-trunk/gcc/cp/name-lookup.c:1313
0x6db13e type_build_ctor_call(tree_node*)
../../gcc-source-trunk/gcc/cp/class.c:5222
0x73cf32 check_initializer
../../gcc-source-trunk/gcc/cp/decl.c:6243
0x75b1d5 cp_finish_decl(tree_node*, tree_node*, bool, tree_node*, int)
../../gcc-source-trunk/gcc/cp/decl.c:7006
0x851287 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
../../gcc-source-trunk/gcc/cp/pt.c:16130
0x84d26b tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
../../gcc-source-trunk/gcc/cp/pt.c:16249
0x84a571 instantiate_decl(tree_node*, bool, bool)
../../gcc-source-trunk/gcc/cp/pt.c:23311
0x89a9e2 instantiate_pending_templates(int)
../../gcc-source-trunk/gcc/cp/pt.c:23427
0x77b172 c_parse_final_cleanups()
../../gcc-source-trunk/gcc/cp/decl2.c:4705
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.
$
---------------------------------
template < int A > class A {};
template < int I > class B
{
void f ()
{
A < I > a;
}
};
template void B < 0 >::f ();
More information about the Gcc-bugs
mailing list