https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89974
Bug ID: 89974
Summary: ICE on a definition of a non-type specialization on a
struct object with pointer to member function
Product: gcc
Version: 9.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: msebor at gcc dot gnu.org
Target Milestone: ---
The following C++ 2a program causes an ICE. An equivalent program using a
pointer to member data compiles successfully. I came across this while testing
my patch for pr47488, pr89833, and pr89876.
$ cat z.C && gcc -c -O2 -Wall -Wextra -std=c++2a z.C
struct A { void (A::*p)(); };
template <A> struct X { };
X<A{ 0 }> x;
z.C:3:9: internal compiler error: canonical types differ for identical types
‘void (A::*)()’ and ‘void (A::*)()’
3 | X<A{ 0 }> x;
| ^
0xb7ba72 comptypes(tree_node*, tree_node*, int)
/src/gcc/git-svn/gcc/cp/typeck.c:1479
0x9b0829 find_substitution
/src/gcc/git-svn/gcc/cp/mangle.c:692
0x9b8840 write_type
/src/gcc/git-svn/gcc/cp/mangle.c:2054
0x9c10a7 write_template_arg_literal
/src/gcc/git-svn/gcc/cp/mangle.c:3357
0x9bd561 write_expression
/src/gcc/git-svn/gcc/cp/mangle.c:2890
0x9bfdcd write_expression
/src/gcc/git-svn/gcc/cp/mangle.c:3150
0x9bfdcd write_expression
/src/gcc/git-svn/gcc/cp/mangle.c:3150
0x9c572f mangle_template_parm_object(tree_node*)
/src/gcc/git-svn/gcc/cp/mangle.c:4267
0xa8c265 get_template_parm_object
/src/gcc/git-svn/gcc/cp/pt.c:6702
0xa8e048 convert_nontype_argument
/src/gcc/git-svn/gcc/cp/pt.c:7160
0xa91795 convert_template_argument
/src/gcc/git-svn/gcc/cp/pt.c:8070
0xa93370 coerce_template_parms
/src/gcc/git-svn/gcc/cp/pt.c:8547
0xa93a65 coerce_innermost_template_parms
/src/gcc/git-svn/gcc/cp/pt.c:8666
0xa96177 lookup_template_class_1
/src/gcc/git-svn/gcc/cp/pt.c:9357
0xa9885d lookup_template_class(tree_node*, tree_node*, tree_node*, tree_node*,
int, int)
/src/gcc/git-svn/gcc/cp/pt.c:9716
0xb240c0 finish_template_type(tree_node*, tree_node*, int)
/src/gcc/git-svn/gcc/cp/semantics.c:3312
0xa223e1 cp_parser_template_id
/src/gcc/git-svn/gcc/cp/parser.c:16479
0xa2f9be cp_parser_class_name
/src/gcc/git-svn/gcc/cp/parser.c:23274
0xa0d6d7 cp_parser_qualifying_entity
/src/gcc/git-svn/gcc/cp/parser.c:6693
0xa0c6cd cp_parser_nested_name_specifier_opt
/src/gcc/git-svn/gcc/cp/parser.c:6379
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.