$ 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> } $
ICE started with r238182.
The new code in cp_build_addr_expr_1 says CASE_CONVERT: case FLOAT_EXPR: case FIX_TRUNC_EXPR: /* We should have handled this above in the lvalue_kind check. */ we arrived here with NOP_EXPR, but we hadn't issued an error in this block: /* Anything not already handled and not a true memory reference is an error. */ if (TREE_CODE (argtype) != FUNCTION_TYPE && TREE_CODE (argtype) != METHOD_TYPE) because strict_lvalue is false. ARG is (const struct ValueType) doubleval.
Author: nathan Date: Thu Jan 5 12:30:26 2017 New Revision: 244101 URL: https://gcc.gnu.org/viewcvs?rev=244101&root=gcc&view=rev Log: cp/ PR c++/78765 * pt.c (convert_nontype_argument): Don't try and see if integral or enum expressions are constants prematurely. testsuite/ PR c++/78765 * g++.dg/cpp0x/pr78765.C: New. Added: trunk/gcc/testsuite/g++.dg/cpp0x/pr78765.C Modified: trunk/gcc/cp/ChangeLog trunk/gcc/cp/pt.c trunk/gcc/testsuite/ChangeLog
Fixed r244101