public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/99697] New: ICE for class template partial specialization over non-template (structural class template) parameter of deduced class type
@ 2021-03-21 16:45 davveston at gmail dot com
  2021-04-30 21:02 ` [Bug c++/99697] " mpolacek at gcc dot gnu.org
  0 siblings, 1 reply; 2+ messages in thread
From: davveston at gmail dot com @ 2021-03-21 16:45 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99697

            Bug ID: 99697
           Summary: ICE for class template partial specialization over
                    non-template (structural class template) parameter of
                    deduced class type
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: davveston at gmail dot com
  Target Milestone: ---

The following program:

// -----------------------------------
// prog.cc
template<int N> struct S {};
template<S s>   struct U {};
template<typename>  struct V;

template<S s> struct V<U<s<0>> {}; // #1: ICE

int main() {}
// -----------------------------------

compiled with gcc HEAD 11.0.1 20210320 (experimental) and the following command

 g++ prog.cc -Wall -Wextra -std=gnu++2b

results in the following ICE (segfault) at #1:

// -----------------------------------
prog.cc:5:28: internal compiler error: Segmentation fault
    5 | template<S s> struct V<U<s<0>> {}; // ICE
      |                            ^
0xca91ff crash_signal
        ../../source/gcc/toplev.c:327
0x63a207 resolve_args(vec<tree_node*, va_gc, vl_embed>*, int)
        ../../source/gcc/cp/call.c:4548
0x78a764 do_class_deduction
        ../../source/gcc/cp/pt.c:29332
0x78a764 do_auto_deduction(tree_node*, tree_node*, tree_node*, int,
auto_deduction_context, tree_node*, int)
        ../../source/gcc/cp/pt.c:29509
0x798c37 convert_template_argument
        ../../source/gcc/cp/pt.c:8491
0x79a19b convert_template_argument
        ../../source/gcc/cp/pt.c:8264
0x79a19b coerce_template_parms
        ../../source/gcc/cp/pt.c:8995
0x79b411 lookup_template_class_1
        ../../source/gcc/cp/pt.c:9833
0x79c3ec lookup_template_class(tree_node*, tree_node*, tree_node*, tree_node*,
int, int)
        ../../source/gcc/cp/pt.c:10237
0x7c028d finish_template_type(tree_node*, tree_node*, int)
        ../../source/gcc/cp/semantics.c:3563
0x75f603 cp_parser_template_id
        ../../source/gcc/cp/parser.c:17458
0x75f86b cp_parser_class_name
        ../../source/gcc/cp/parser.c:24685
0x75783a cp_parser_qualifying_entity
        ../../source/gcc/cp/parser.c:7002
0x75783a cp_parser_nested_name_specifier_opt
        ../../source/gcc/cp/parser.c:6684
0x76c30f cp_parser_simple_type_specifier
        ../../source/gcc/cp/parser.c:18851
0x74cd8d cp_parser_type_specifier
        ../../source/gcc/cp/parser.c:18509
0x75d323 cp_parser_type_specifier_seq
        ../../source/gcc/cp/parser.c:23360
0x75bba4 cp_parser_type_id_1
        ../../source/gcc/cp/parser.c:23163
0x75de83 cp_parser_template_type_arg
        ../../source/gcc/cp/parser.c:23268
0x75dfaf cp_parser_template_argument
        ../../source/gcc/cp/parser.c:17908
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.
// -----------------------------------

I think the partial specialization at #1 can never be used as the non-type
template parameter 's' of deduced class type can never be deduced, such that
the correct behaviour should arguably be to reject the program as ill-formed
(at #1).

Demo: https://wandbox.org/permlink/ufm4B9uIn8dgHYAI

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [Bug c++/99697] ICE for class template partial specialization over non-template (structural class template) parameter of deduced class type
  2021-03-21 16:45 [Bug c++/99697] New: ICE for class template partial specialization over non-template (structural class template) parameter of deduced class type davveston at gmail dot com
@ 2021-04-30 21:02 ` mpolacek at gcc dot gnu.org
  0 siblings, 0 replies; 2+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2021-04-30 21:02 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99697

Marek Polacek <mpolacek at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
                 CC|                            |mpolacek at gcc dot gnu.org
             Status|UNCONFIRMED                 |RESOLVED

--- Comment #1 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Fixed by r12-100.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-04-30 21:02 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-21 16:45 [Bug c++/99697] New: ICE for class template partial specialization over non-template (structural class template) parameter of deduced class type davveston at gmail dot com
2021-04-30 21:02 ` [Bug c++/99697] " mpolacek at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).