https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78765
Bug ID: 78765 Summary: ICE on invalid C++ code on x86_64-linux-gnu (internal compiler error: in cp_build_addr_expr_1, at cp/typeck.c:5708) Product: gcc Version: 7.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: chengniansun at gmail dot com Target Milestone: --- $ gcc-trunk -v Using built-in specs. COLLECT_GCC=gcc-trunk COLLECT_LTO_WRAPPER=/usr/local/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/7.0.0/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.0 20161210 (experimental) [trunk revision 243516] (GCC) $ $ gcc-trunk small.C small.C:6:42: error: ‘v’ was not declared in this scope static constexpr ValueType doubleval = v; ^ small.C: In function ‘int main()’: small.C:9:52: internal compiler error: in cp_build_addr_expr_1, at cp/typeck.c:5708 int main() { ValueTypeInfo<ValueTypeEnum::doubleval> } ^ 0x7eb7d5 cp_build_addr_expr_1 ../../gcc-source-trunk/gcc/cp/typeck.c:5708 0x683162 add_function_candidate ../../gcc-source-trunk/gcc/cp/call.c:2158 0x6848c7 add_candidates ../../gcc-source-trunk/gcc/cp/call.c:5491 0x67f9e4 build_user_type_conversion_1 ../../gcc-source-trunk/gcc/cp/call.c:3842 0x680a8a implicit_conversion ../../gcc-source-trunk/gcc/cp/call.c:1898 0x6890dd build_integral_nontype_arg_conv(tree_node*, tree_node*, int) ../../gcc-source-trunk/gcc/cp/call.c:4025 0x70afa5 convert_nontype_argument ../../gcc-source-trunk/gcc/cp/pt.c:6434 0x711eed convert_template_argument ../../gcc-source-trunk/gcc/cp/pt.c:7363 0x71fa63 coerce_template_parms ../../gcc-source-trunk/gcc/cp/pt.c:7823 0x72199a lookup_template_class_1 ../../gcc-source-trunk/gcc/cp/pt.c:8396 0x72199a lookup_template_class(tree_node*, tree_node*, tree_node*, tree_node*, int, int) ../../gcc-source-trunk/gcc/cp/pt.c:8738 0x836bed finish_template_type(tree_node*, tree_node*, int) ../../gcc-source-trunk/gcc/cp/semantics.c:3146 0x7bea14 cp_parser_template_id ../../gcc-source-trunk/gcc/cp/parser.c:15464 0x7becba cp_parser_class_name ../../gcc-source-trunk/gcc/cp/parser.c:21879 0x7af07d cp_parser_qualifying_entity ../../gcc-source-trunk/gcc/cp/parser.c:6293 0x7af07d cp_parser_nested_name_specifier_opt ../../gcc-source-trunk/gcc/cp/parser.c:5977 0x7acd20 cp_parser_simple_type_specifier ../../gcc-source-trunk/gcc/cp/parser.c:16793 0x7aa261 cp_parser_type_specifier ../../gcc-source-trunk/gcc/cp/parser.c:16464 0x7bf3d3 cp_parser_decl_specifier_seq ../../gcc-source-trunk/gcc/cp/parser.c:13303 0x7c9770 cp_parser_simple_declaration ../../gcc-source-trunk/gcc/cp/parser.c:12646 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. $ $ cat small.C class ValueType { operator int(); int m_ID; }; class ValueTypeEnum { static constexpr ValueType doubleval = v; }; template <int> class ValueTypeInfo; int main() { ValueTypeInfo<ValueTypeEnum::doubleval> } $