Bug 68728 - [6 Regression] ice: unexpected expression ‘(const char*)__s’ of kind implicit_conv_expr
Summary: [6 Regression] ice: unexpected expression ‘(const char*)__s’ of kind implicit...
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 6.0
: P3 normal
Target Milestone: 6.0
Assignee: Not yet assigned to anyone
URL:
Keywords: error-recovery
Depends on:
Blocks:
 
Reported: 2015-12-05 19:01 UTC by John Regehr
Modified: 2016-03-14 09:15 UTC (History)
3 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2015-12-07 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description John Regehr 2015-12-05 19:01:28 UTC
ICE on invalid code

$ g++ -v
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/home/regehr/z/compiler-install/gcc-r231259-install/libexec/gcc/x86_64-pc-linux-gnu/6.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /home/regehr/z/compiler-source/gcc/configure --prefix=/home/regehr/z/compiler-install/gcc-r231259-install --disable-bootstrap --disable-multilib --enable-languages=c,c++
Thread model: posix
gcc version 6.0.0 20151204 (experimental) (GCC) 


$ cat hello.cpp
template < _CharT > fn1 ( char __s ):( __builtin_strcmp ( __s, "" )


$ g++ -w -std=c++11 hello.cpp
hello.cpp:1:12: error: ‘_CharT’ has not been declared
 template < _CharT > fn1 ( char __s ):( __builtin_strcmp ( __s, "" )
            ^~~~~~

hello.cpp:1:36: error: ISO C++ forbids declaration of ‘fn1’ with no type [-fpermissive]
 template < _CharT > fn1 ( char __s ):( __builtin_strcmp ( __s, "" )
                                    ^

hello.cpp: In function ‘int fn1(char)’:
hello.cpp:1:38: error: only constructors take member initializers
 template < _CharT > fn1 ( char __s ):( __builtin_strcmp ( __s, "" )
                                      ^

hello.cpp:1:38: error: anachronistic old-style base class initializer [-fpermissive]
hello.cpp:1:67: internal compiler error: unexpected expression ‘(const char*)__s’ of kind implicit_conv_expr
 template < _CharT > fn1 ( char __s ):( __builtin_strcmp ( __s, "" )
                                                                   ^

0x7ef982 cxx_eval_constant_expression
	/home/regehr/z/compiler-source/gcc/gcc/cp/constexpr.c:3719
0x7f3b44 cxx_eval_outermost_constant_expr
	/home/regehr/z/compiler-source/gcc/gcc/cp/constexpr.c:3774
0x7f6875 maybe_constant_value_1
	/home/regehr/z/compiler-source/gcc/gcc/cp/constexpr.c:3960
0x7f6875 maybe_constant_value(tree_node*, tree_node*)
	/home/regehr/z/compiler-source/gcc/gcc/cp/constexpr.c:3981
0x5a2ee5 build_cxx_call(tree_node*, int, tree_node**, int)
	/home/regehr/z/compiler-source/gcc/gcc/cp/call.c:7724
0x7182ea cp_build_function_call_vec(tree_node*, vec<tree_node*, va_gc, vl_embed>**, int)
	/home/regehr/z/compiler-source/gcc/gcc/cp/typeck.c:3593
0x5bb291 build_new_function_call(tree_node*, vec<tree_node*, va_gc, vl_embed>**, bool, int)
	/home/regehr/z/compiler-source/gcc/gcc/cp/call.c:4104
0x75c95e finish_call_expr(tree_node*, vec<tree_node*, va_gc, vl_embed>**, bool, bool, int)
	/home/regehr/z/compiler-source/gcc/gcc/cp/semantics.c:2403
0x6d0e6b cp_parser_postfix_expression
	/home/regehr/z/compiler-source/gcc/gcc/cp/parser.c:6656
0x6daf08 cp_parser_unary_expression
	/home/regehr/z/compiler-source/gcc/gcc/cp/parser.c:7688
0x6dbc58 cp_parser_binary_expression
	/home/regehr/z/compiler-source/gcc/gcc/cp/parser.c:8442
0x6dc51f cp_parser_assignment_expression
	/home/regehr/z/compiler-source/gcc/gcc/cp/parser.c:8712
0x6de608 cp_parser_parenthesized_expression_list
	/home/regehr/z/compiler-source/gcc/gcc/cp/parser.c:7185
0x6ef7ad cp_parser_mem_initializer
	/home/regehr/z/compiler-source/gcc/gcc/cp/parser.c:13180
0x6ef7ad cp_parser_mem_initializer_list
	/home/regehr/z/compiler-source/gcc/gcc/cp/parser.c:13063
0x6ef7ad cp_parser_ctor_initializer_opt
	/home/regehr/z/compiler-source/gcc/gcc/cp/parser.c:13032
0x6ef7ad cp_parser_ctor_initializer_opt_and_function_body
	/home/regehr/z/compiler-source/gcc/gcc/cp/parser.c:20215
0x6f0286 cp_parser_function_definition_after_declarator
	/home/regehr/z/compiler-source/gcc/gcc/cp/parser.c:24838
0x6f109a cp_parser_function_definition_from_specifiers_and_declarator
	/home/regehr/z/compiler-source/gcc/gcc/cp/parser.c:24750
0x6f109a cp_parser_init_declarator
	/home/regehr/z/compiler-source/gcc/gcc/cp/parser.c:17974
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.
Comment 1 Marek Polacek 2015-12-07 17:19:55 UTC
Confirmed.
Comment 2 Jakub Jelinek 2016-03-14 09:11:59 UTC
Started with r230365.
Comment 3 Jakub Jelinek 2016-03-14 09:15:43 UTC
Ah, but the error-recovery bug got fixed with r232438.