https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84325
Bug ID: 84325 Summary: internal compiler error, in cxx_eval_constant_expression gcc/cp/constexpr.c:4740 Product: gcc Version: 8.0.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: ababakhar at gmail dot com Target Milestone: --- ~/tests/c++/bug2$ cat test.ii struct seconds { int i_{0}; }; template <char... _Digits> constexpr seconds operator""_s() { return seconds(0); } constexpr seconds operator""_s(long double i) { return seconds(); } template<class TYPE> struct Param { constexpr static seconds time_to_wait{10_s}; }; struct Empty {}; Param<Empty> p; ~/tests/c++/bug2$ g++ -v Using built-in specs. COLLECT_GCC=g++ COLLECT_LTO_WRAPPER=/spare/local/suzutrade/opt/gcc/libexec/gcc/x86_64-pc-linux-gnu/8.0.1/lto-wrapper Target: x86_64-pc-linux-gnu Configured with: ./configure --prefix=/spare/local/suzutrade/opt/gcc --with-mpfr=/spare/local/suzutrade/opt/mpfr --with-mpc=/spare/local/suzutrade/opt/mpc --with-gmp=/spare/local/suzutrade/opt/gmp Thread model: posix gcc version 8.0.1 20180210 (experimental) (GCC) ~/tests/c++/bug2$ g++ test.ii test.ii:10:45: internal compiler error: unexpected expression ‘(const seconds)operator""_s<'1', '0'>()’ of kind implicit_conv_expr constexpr static seconds time_to_wait{10_s}; ^ 0x821cb0 cxx_eval_constant_expression ../.././gcc/cp/constexpr.c:4740 0x8244e7 cxx_eval_outermost_constant_expr ../.././gcc/cp/constexpr.c:4800 0x9b93f2 store_init_value(tree_node*, tree_node*, vec<tree_node*, va_gc, vl_embed>**, int) ../.././gcc/cp/typeck2.c:833 0x84f2da check_initializer ../.././gcc/cp/decl.c:6378 0x8671a0 cp_finish_decl(tree_node*, tree_node*, bool, tree_node*, int) ../.././gcc/cp/decl.c:6931 0x87d88c grokfield(cp_declarator const*, cp_decl_specifier_seq*, tree_node*, bool, tree_node*, tree_node*) ../.././gcc/cp/decl2.c:993 0x8f3d0e cp_parser_member_declaration ../.././gcc/cp/parser.c:23871 0x8f4c9a cp_parser_member_specification_opt ../.././gcc/cp/parser.c:23345 0x8f4c9a cp_parser_class_specifier_1 ../.././gcc/cp/parser.c:22487 0x8f6cf9 cp_parser_class_specifier ../.././gcc/cp/parser.c:22739 0x8f6cf9 cp_parser_type_specifier ../.././gcc/cp/parser.c:16745 0x903e86 cp_parser_decl_specifier_seq ../.././gcc/cp/parser.c:13606 0x9085c5 cp_parser_single_declaration ../.././gcc/cp/parser.c:27051 0x90894c cp_parser_template_declaration_after_parameters ../.././gcc/cp/parser.c:26743 0x90920c cp_parser_explicit_template_declaration ../.././gcc/cp/parser.c:26980 0x90920c cp_parser_template_declaration_after_export ../.././gcc/cp/parser.c:26999 0x90e579 cp_parser_declaration ../.././gcc/cp/parser.c:12710 0x90e861 cp_parser_declaration_seq_opt ../.././gcc/cp/parser.c:12637 0x90eb54 cp_parser_translation_unit ../.././gcc/cp/parser.c:4559 0x90eb54 c_parse_file() ../.././gcc/cp/parser.c:38857 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.