Bug 84822 - Partial specializing template<auto> internal compiler error
Summary: Partial specializing template<auto> internal compiler error
Status: NEW
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 7.2.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords: ice-on-valid-code
Depends on:
Blocks:
 
Reported: 2018-03-11 21:22 UTC by Fei Teng
Modified: 2019-06-18 19:53 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2018-03-12 00:00:00


Attachments
the preprocessed file (*.i*) that triggers the bug (311 bytes, text/plain)
2018-03-11 21:22 UTC, Fei Teng
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Fei Teng 2018-03-11 21:22:53 UTC
Created attachment 43625 [details]
the preprocessed file (*.i*) that triggers the bug

When partially specializing template<auto> with more than one auto non-type template parameters, a mixed usage of auto non-type template argument and named non-type template argument causes ICE. 
Example code 
https://godbolt.org/g/3GebP8 
contains several variants of the error.

g++ (Ubuntu 7.2.0-1ubuntu1~16.04) 7.2.0

g++ partialspecializationbug.cpp -std=c++17

partialspecializationbug.cpp:72:34: internal compiler error: Segmentation fault
     Listener<&Foo::evt, &Bar::f> conn;
                                  ^~~~
0xae558f crash_signal
        ../../src/gcc/toplev.c:337
0x5e187a unify
        ../../src/gcc/cp/pt.c:20513
0x5e1680 unify
        ../../src/gcc/cp/pt.c:21006
0x5f36e1 unify_one_argument
        ../../src/gcc/cp/pt.c:19128
0x5f8726 type_unification_real
        ../../src/gcc/cp/pt.c:19248
0x5e0313 do_auto_deduction(tree_node*, tree_node*, tree_node*, int, auto_deduction_context, tree_node*, int)
        ../../src/gcc/cp/pt.c:25537
0x5e1f5d unify
        ../../src/gcc/cp/pt.c:20662
0x5e1508 unify
        ../../src/gcc/cp/pt.c:20851
0x5e2991 get_partial_spec_bindings
        ../../src/gcc/cp/pt.c:21648
0x5e2d1d most_specialized_partial_spec
        ../../src/gcc/cp/pt.c:21919
0x5fe4db instantiate_class_template_1
        ../../src/gcc/cp/pt.c:10312
0x5fe4db instantiate_class_template(tree_node*)
        ../../src/gcc/cp/pt.c:10880
0x662305 complete_type(tree_node*)
        ../../src/gcc/cp/typeck.c:133
0x5cea01 grokdeclarator(cp_declarator const*, cp_decl_specifier_seq*, decl_context, int, tree_node**)
        ../../src/gcc/cp/decl.c:12043
0x61e302 grokfield(cp_declarator const*, cp_decl_specifier_seq*, tree_node*, bool, tree_node*, tree_node*)
        ../../src/gcc/cp/decl2.c:806
0x63343b cp_parser_member_declaration
        ../../src/gcc/cp/parser.c:23419
0x633e0a cp_parser_member_specification_opt
        ../../src/gcc/cp/parser.c:22968
0x633e0a cp_parser_class_specifier_1
        ../../src/gcc/cp/parser.c:22121
0x635a61 cp_parser_class_specifier
        ../../src/gcc/cp/parser.c:22373
0x635a61 cp_parser_type_specifier
        ../../src/gcc/cp/parser.c:16446
Comment 1 Richard Biener 2018-03-12 09:24:13 UTC
confirmed.
Comment 2 Marek Polacek 2018-03-12 09:46:12 UTC
Started with r242017.  Rejected before:
error: ‘auto’ parameter not permitted in this context
Comment 3 Marek Polacek 2019-06-18 19:53:52 UTC
Still ICEs.