https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79371
Bug ID: 79371 Summary: ICE on valid C++14 code on x86_64-linux-gnu: in build_class_member_access_expr, at cp/typeck.c:2296 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 ICE seems to be a recent regression. The code is mistakenly rejected by GCC 6.x and earlier. It is correctly accepted by Clang and crashes ICC. $ 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/7.0.1/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 7.0.1 20170203 (experimental) [trunk revision 245148] (GCC) $ $ clang++ -c -std=c++14 small.cpp $ icc -c -std=c++14 small.cpp small.cpp(6): internal error: assertion failed at: "shared/cfe/edgcpfe/class_decl.c", line 3575 int b = S().a < int >; ^ compilation aborted for small.cpp (code 4) $ $ g++-trunk -c -std=c++14 small.cpp small.cpp:6:13: internal compiler error: in build_class_member_access_expr, at cp/typeck.c:2296 int b = S().a < int >; ^~~~~~~~~ 0x80a0cc build_class_member_access_expr(cp_expr, tree_node*, tree_node*, bool, int) ../../gcc-source-trunk/gcc/cp/typeck.c:2296 0x80a48a finish_class_member_access_expr(cp_expr, tree_node*, bool, int) ../../gcc-source-trunk/gcc/cp/typeck.c:2900 0x7c47b4 cp_parser_postfix_dot_deref_expression ../../gcc-source-trunk/gcc/cp/parser.c:7443 0x7c1d44 cp_parser_postfix_expression ../../gcc-source-trunk/gcc/cp/parser.c:7046 0x7bdcbc cp_parser_unary_expression ../../gcc-source-trunk/gcc/cp/parser.c:8098 0x7caa17 cp_parser_cast_expression ../../gcc-source-trunk/gcc/cp/parser.c:8775 0x7caff3 cp_parser_binary_expression ../../gcc-source-trunk/gcc/cp/parser.c:8876 0x7cb8e4 cp_parser_assignment_expression ../../gcc-source-trunk/gcc/cp/parser.c:9163 0x7cbd2a cp_parser_constant_expression ../../gcc-source-trunk/gcc/cp/parser.c:9433 0x7cc584 cp_parser_initializer_clause ../../gcc-source-trunk/gcc/cp/parser.c:21569 0x7ce093 cp_parser_initializer ../../gcc-source-trunk/gcc/cp/parser.c:21509 0x7ddf80 cp_parser_init_declarator ../../gcc-source-trunk/gcc/cp/parser.c:19328 0x7de7e1 cp_parser_simple_declaration ../../gcc-source-trunk/gcc/cp/parser.c:12776 0x7df52a cp_parser_block_declaration ../../gcc-source-trunk/gcc/cp/parser.c:12594 0x7e77f4 cp_parser_declaration ../../gcc-source-trunk/gcc/cp/parser.c:12491 0x7e7b66 cp_parser_declaration_seq_opt ../../gcc-source-trunk/gcc/cp/parser.c:12367 0x7e7e84 cp_parser_translation_unit ../../gcc-source-trunk/gcc/cp/parser.c:4366 0x7e7e84 c_parse_file() ../../gcc-source-trunk/gcc/cp/parser.c:38382 0x94d6f2 c_common_parse_file() ../../gcc-source-trunk/gcc/c-family/c-opts.c:1107 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. $ -------------------------------------------- struct S { template < typename > static int &a; }; int b = S().a < int >;