http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55801
Bug #: 55801 Summary: ICE with thread_local after ill-formed forward declaration Classification: Unclassified Product: gcc Version: 4.8.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassig...@gcc.gnu.org ReportedBy: vlu...@gmx.de The following ill-formed snippet: --------------------------------------------------------- class C; class ::C; thread_local C O, O2 = O; -------------------------------------------------------- Compiled with "c++ -std=c++0x -c" produces an ICE: -------------------------------------------------------- thread_local.ice.gcc-4.8.cc:2:9: warning: declaration 'class C' does not declare anything [enabled by default] class ::C; ^ thread_local.ice.gcc-4.8.cc:3:16: error: aggregate 'C O' has incomplete type and cannot be defined thread_local C O, O2 = O; ^ thread_local.ice.gcc-4.8.cc:3:19: error: variable 'C O2' has initializer but incomplete type thread_local C O, O2 = O; ^ thread_local.ice.gcc-4.8.cc:3:24: internal compiler error: tree check: expected class 'type', have 'exceptional' (error_mark) in var_defined_without_dynamic_init, at cp/decl2.c:2795 thread_local C O, O2 = O; ^ 0xc6ef89 tree_class_check_failed(tree_node const*, tree_code_class, char const*, int, char const*) ../../gcc_svn/gcc/tree.c:9007 0x5e1bfc tree_class_check ../../gcc_svn/gcc/tree.h:3794 0x5e1bfc var_defined_without_dynamic_init ../../gcc_svn/gcc/cp/decl2.c:2795 0x5e1bfc var_needs_tls_wrapper ../../gcc_svn/gcc/cp/decl2.c:2813 0x5eeb6b get_tls_wrapper_fn(tree_node*) ../../gcc_svn/gcc/cp/decl2.c:2876 0x698816 finish_id_expression(tree_node*, tree_node*, tree_node*, cp_id_kind*, bool, bool, bool*, bool, bool, bool, bool, char const**, unsigned int) ../../gcc_svn/gcc/cp/semantics.c:3296 0x61586d cp_parser_primary_expression ../../gcc_svn/gcc/cp/parser.c:4395 0x61736a cp_parser_postfix_expression ../../gcc_svn/gcc/cp/parser.c:5630 0x61987a cp_parser_unary_expression ../../gcc_svn/gcc/cp/parser.c:6686 0x61a3f7 cp_parser_binary_expression ../../gcc_svn/gcc/cp/parser.c:7360 0x61a885 cp_parser_assignment_expression ../../gcc_svn/gcc/cp/parser.c:7585 0x61acc4 cp_parser_constant_expression ../../gcc_svn/gcc/cp/parser.c:7816 0x626dfe cp_parser_init_declarator ../../gcc_svn/gcc/cp/parser.c:15986 0x62738e cp_parser_simple_declaration ../../gcc_svn/gcc/cp/parser.c:10562 0x629160 cp_parser_block_declaration ../../gcc_svn/gcc/cp/parser.c:10443 0x631d4b cp_parser_declaration ../../gcc_svn/gcc/cp/parser.c:10340 0x630a1d cp_parser_declaration_seq_opt ../../gcc_svn/gcc/cp/parser.c:10226 0x6322c2 cp_parser_translation_unit ../../gcc_svn/gcc/cp/parser.c:3808 0x6322c2 c_parse_file() ../../gcc_svn/gcc/cp/parser.c:28177 0x738854 c_common_parse_file() ../../gcc_svn/gcc/c-family/c-opts.c:1023 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. -------------------------------------------------------------- Output of "c++ -v" is: -------------------------------------------------------------- Using built-in specs. COLLECT_GCC=/home/lima/vanilla_installs/gcc_and_tools/bin/c++ COLLECT_LTO_WRAPPER=/home/lima/vanilla_installs/gcc_and_tools/lib/gcc/x86_64-unknown-linux-gnu/4.8.0/lto-wrapper Target: x86_64-unknown-linux-gnu Configured with: ../gcc_svn/configure --prefix=/home/lima/vanilla_installs/gcc_and_tools --enable-__cxa_atexit --enable-languages=c,c++ --disable-nls --disable-multilib Thread model: posix gcc version 4.8.0 20121223 (experimental) (GCC) ---------------------------------------------------------------