[Bug c++/79650] New: ICE on invalid c++ code with -std=c++1z in convert_nontype_argument (pt.c:6515)
marxin at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Tue Feb 21 08:14:00 GMT 2017
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79650
Bug ID: 79650
Summary: ICE on invalid c++ code with -std=c++1z in
convert_nontype_argument (pt.c:6515)
Product: gcc
Version: unknown
Status: UNCONFIRMED
Keywords: ice-on-invalid-code
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: marxin at gcc dot gnu.org
Target Milestone: ---
Moved from clang++ test-suite:
$ g++
/home/marxin/BIG/Programming/llvm-project/llvm/tools/clang/test/SemaTemplate/temp_arg_nontype_cxx1z.cpp
/home/marxin/BIG/Programming/llvm-project/llvm/tools/clang/test/SemaTemplate/temp_arg_nontype_cxx1z.cpp:9:24:
error: ‘"test"’ is not a valid template argument for type ‘const char*’ because
string literals can never be used in this context
A<const char*, "test"> a; // expected-error {{does not refer to any
declaration}}
^
/home/marxin/BIG/Programming/llvm-project/llvm/tools/clang/test/SemaTemplate/temp_arg_nontype_cxx1z.cpp:10:30:
error: ‘"test"’ is not a valid template argument for type ‘const char (&)[5]’
because string literals can never be used in this context
A<const char (&)[5], "test"> b; // expected-error {{does not refer to any
declaration}}
^
/home/marxin/BIG/Programming/llvm-project/llvm/tools/clang/test/SemaTemplate/temp_arg_nontype_cxx1z.cpp:18:25:
error: template argument 2 is invalid
A<const char*, &arr[0]> c;
^
/home/marxin/BIG/Programming/llvm-project/llvm/tools/clang/test/SemaTemplate/temp_arg_nontype_cxx1z.cpp:19:25:
error: template argument 2 is invalid
A<const char*, &arr[1]> d; // expected-error {{refers to subobject
'&arr[1]'}}
^
/home/marxin/BIG/Programming/llvm-project/llvm/tools/clang/test/SemaTemplate/temp_arg_nontype_cxx1z.cpp:20:26:
error: the value of ‘Array::arr’ is not usable in a constant expression
A<const char*, (&arr)[0]> e;
^
/home/marxin/BIG/Programming/llvm-project/llvm/tools/clang/test/SemaTemplate/temp_arg_nontype_cxx1z.cpp:14:8:
note: ‘Array::arr’ was not declared ‘constexpr’
char arr[3];
^~~
/home/marxin/BIG/Programming/llvm-project/llvm/tools/clang/test/SemaTemplate/temp_arg_nontype_cxx1z.cpp:22:26:
error: template argument 2 is invalid
A<const char*, &(&x)[0]> g;
^
/home/marxin/BIG/Programming/llvm-project/llvm/tools/clang/test/SemaTemplate/temp_arg_nontype_cxx1z.cpp:23:26:
error: template argument 2 is invalid
A<const char*, &(&x)[1]> h; // expected-error {{refers to subobject '&x +
1'}}
^
/home/marxin/BIG/Programming/llvm-project/llvm/tools/clang/test/SemaTemplate/temp_arg_nontype_cxx1z.cpp:24:19:
error: could not convert template argument ‘0’ from ‘int’ to ‘const char*’
A<const char*, 0> i; // expected-error {{not allowed in a converted
constant}}
^
/home/marxin/BIG/Programming/llvm-project/llvm/tools/clang/test/SemaTemplate/temp_arg_nontype_cxx1z.cpp:43:30:
error: could not convert template argument ‘i<int>’ from ‘<unresolved
overloaded function type>’ to ‘void (*)()’
typedef A<void (*)(), i<int>> e; // expected-error {{is not implicitly
convertible}}
^~
/home/marxin/BIG/Programming/llvm-project/llvm/tools/clang/test/SemaTemplate/temp_arg_nontype_cxx1z.cpp:45:26:
error: could not convert template argument ‘0’ from ‘int’ to ‘void (*)()’
typedef A<void (*)(), 0> x; // expected-error {{not allowed in a converted
constant}}
^
/home/marxin/BIG/Programming/llvm-project/llvm/tools/clang/test/SemaTemplate/temp_arg_nontype_cxx1z.cpp:
In function ‘void Func()’:
/home/marxin/BIG/Programming/llvm-project/llvm/tools/clang/test/SemaTemplate/temp_arg_nontype_cxx1z.cpp:50:18:
error: the value of ‘__func__’ is not usable in a constant expression
A<const char*, __func__> a; // expected-error {{does not refer to any
declaration}}
^~~~~~~~
/home/marxin/BIG/Programming/llvm-project/llvm/tools/clang/test/SemaTemplate/temp_arg_nontype_cxx1z.cpp:50:18:
note: ‘__func__’ was not declared ‘constexpr’
/home/marxin/BIG/Programming/llvm-project/llvm/tools/clang/test/SemaTemplate/temp_arg_nontype_cxx1z.cpp:50:26:
error: ‘__func__’ is not a valid template argument of type ‘const char*’
because ‘__func__’ has no linkage
A<const char*, __func__> a; // expected-error {{does not refer to any
declaration}}
^
/home/marxin/BIG/Programming/llvm-project/llvm/tools/clang/test/SemaTemplate/temp_arg_nontype_cxx1z.cpp:
In function ‘void LabelAddrDiff::f()’:
/home/marxin/BIG/Programming/llvm-project/llvm/tools/clang/test/SemaTemplate/temp_arg_nontype_cxx1z.cpp:55:94:
internal compiler error: in convert_nontype_argument, at cp/pt.c:6515
a: b: A<int, __builtin_constant_p(true) ? (__INTPTR_TYPE__)&&b -
(__INTPTR_TYPE__)&&a : 0> s; // expected-error {{label address difference}}
^
0x8b0d6a convert_nontype_argument
../../gcc/cp/pt.c:6515
0x8b526c convert_template_argument
../../gcc/cp/pt.c:7657
0x8b6d20 coerce_template_parms
../../gcc/cp/pt.c:8117
0x8b72a6 coerce_innermost_template_parms
../../gcc/cp/pt.c:8222
0x8b99b0 lookup_template_class_1
../../gcc/cp/pt.c:8641
0x8bc5c8 lookup_template_class(tree_node*, tree_node*, tree_node*, tree_node*,
int, int)
../../gcc/cp/pt.c:8987
0xa57c75 finish_template_type(tree_node*, tree_node*, int)
../../gcc/cp/semantics.c:3151
0x9a14f7 cp_parser_template_id
../../gcc/cp/parser.c:15513
0x9adbe0 cp_parser_class_name
../../gcc/cp/parser.c:21971
0x98eaa2 cp_parser_qualifying_entity
../../gcc/cp/parser.c:6285
0x98d97d cp_parser_nested_name_specifier_opt
../../gcc/cp/parser.c:5971
0x9a3990 cp_parser_simple_type_specifier
../../gcc/cp/parser.c:16844
0x9a304b cp_parser_type_specifier
../../gcc/cp/parser.c:16519
0x99dd17 cp_parser_decl_specifier_seq
../../gcc/cp/parser.c:13352
0x99c73a cp_parser_simple_declaration
../../gcc/cp/parser.c:12676
0x99c6c2 cp_parser_block_declaration
../../gcc/cp/parser.c:12621
0x99bb3a cp_parser_declaration_statement
../../gcc/cp/parser.c:12230
0x998250 cp_parser_statement
../../gcc/cp/parser.c:10717
0x998e6e cp_parser_statement_seq_opt
../../gcc/cp/parser.c:11049
0x998d6b cp_parser_compound_statement
../../gcc/cp/parser.c:11003
More information about the Gcc-bugs
mailing list