public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/98810] New: [C++20] ICE in tsubst_copy, at cp/pt.c:16771
@ 2021-01-24 20:31 dimitri.gorokhovik at free dot fr
  2021-01-25  9:42 ` [Bug c++/98810] " rguenth at gcc dot gnu.org
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: dimitri.gorokhovik at free dot fr @ 2021-01-24 20:31 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 98810
           Summary: [C++20] ICE in tsubst_copy, at cp/pt.c:16771
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: dimitri.gorokhovik at free dot fr
  Target Milestone: ---

The code:

template <auto> struct a {};
template <int i, const a <i> s = a <i> {}> using b = a <s>;
template <int i> constexpr auto g (const b <i> &) { return true; };

compiled with 'g++ -std=c++20 -c bug-13.cpp'  (g++ (GCC) 11.0.0 20210123
(experimental)), produces:

ug-13.cpp: In substitution of ‘template<int i, a<i> s> using b = a<((const
a<i>)s)> [with int i = i; a<i> s = a<i>{}]’:
bug-13.cpp:4:46:   required from here
bug-13.cpp:3:57: internal compiler error: in tsubst_copy, at cp/pt.c:16771
    3 | template <int i, const a <i> s = a <i> {}> using b = a <s>;
      |                                                         ^
0x6cb940 tsubst_copy
        ../../src/gcc/cp/pt.c:16771
0xac3c42 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
bool)
        ../../src/gcc/cp/pt.c:20766
0xacee68 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
        ../../src/gcc/cp/pt.c:19019
0xae1a4e tsubst_template_args(tree_node*, tree_node*, int, tree_node*)
        ../../src/gcc/cp/pt.c:13322
0xaecf83 tsubst_aggr_type
        ../../src/gcc/cp/pt.c:13525
0xacbed0 tsubst_decl
        ../../src/gcc/cp/pt.c:14763
0xade475 instantiate_template_1
        ../../src/gcc/cp/pt.c:21016
0xadf76f instantiate_template(tree_node*, tree_node*, int)
        ../../src/gcc/cp/pt.c:21075
0xadf76f instantiate_alias_template
        ../../src/gcc/cp/pt.c:21113
0xadf76f tsubst(tree_node*, tree_node*, int, tree_node*)
        ../../src/gcc/cp/pt.c:15394
0xaeb4ff lookup_template_class_1
        ../../src/gcc/cp/pt.c:9937
0xaec8dc lookup_template_class(tree_node*, tree_node*, tree_node*, tree_node*,
int, int)
        ../../src/gcc/cp/pt.c:10226
0xb1431b finish_template_type(tree_node*, tree_node*, int)
        ../../src/gcc/cp/semantics.c:3464
0xa87531 cp_parser_template_id
        ../../src/gcc/cp/parser.c:17406
0xa8771b cp_parser_class_name
        ../../src/gcc/cp/parser.c:24631
0xa7ecba cp_parser_qualifying_entity
        ../../src/gcc/cp/parser.c:6994
0xa7ecba cp_parser_nested_name_specifier_opt
        ../../src/gcc/cp/parser.c:6676
0xa94234 cp_parser_simple_type_specifier
        ../../src/gcc/cp/parser.c:18799
0xa7332d cp_parser_type_specifier
        ../../src/gcc/cp/parser.c:18457
0xa74329 cp_parser_decl_specifier_seq
        ../../src/gcc/cp/parser.c:15003
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.

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

* [Bug c++/98810] [C++20] ICE in tsubst_copy, at cp/pt.c:16771
  2021-01-24 20:31 [Bug c++/98810] New: [C++20] ICE in tsubst_copy, at cp/pt.c:16771 dimitri.gorokhovik at free dot fr
@ 2021-01-25  9:42 ` rguenth at gcc dot gnu.org
  2021-02-12  4:51 ` [Bug c++/98810] [9/10/11 Regression] " mpolacek at gcc dot gnu.org
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-01-25  9:42 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2021-01-25
             Status|UNCONFIRMED                 |NEW
     Ever confirmed|0                           |1
           Keywords|                            |ice-on-valid-code

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
clang accepts it with -std=c++17, GCC rejects it there with

t.C:2:41: error: non-type template parameters of class type only available with
'-std=c++20' or '-std=gnu++20'

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

* [Bug c++/98810] [9/10/11 Regression] [C++20] ICE in tsubst_copy, at cp/pt.c:16771
  2021-01-24 20:31 [Bug c++/98810] New: [C++20] ICE in tsubst_copy, at cp/pt.c:16771 dimitri.gorokhovik at free dot fr
  2021-01-25  9:42 ` [Bug c++/98810] " rguenth at gcc dot gnu.org
@ 2021-02-12  4:51 ` mpolacek at gcc dot gnu.org
  2021-02-26  3:57 ` cvs-commit at gcc dot gnu.org
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2021-02-12  4:51 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P2
            Summary|[C++20] ICE in tsubst_copy, |[9/10/11 Regression]
                   |at cp/pt.c:16771            |[C++20] ICE in tsubst_copy,
                   |                            |at cp/pt.c:16771
                 CC|                            |jason at gcc dot gnu.org,
                   |                            |mpolacek at gcc dot gnu.org
   Target Milestone|---                         |9.4

--- Comment #2 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
r273592

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

* [Bug c++/98810] [9/10/11 Regression] [C++20] ICE in tsubst_copy, at cp/pt.c:16771
  2021-01-24 20:31 [Bug c++/98810] New: [C++20] ICE in tsubst_copy, at cp/pt.c:16771 dimitri.gorokhovik at free dot fr
  2021-01-25  9:42 ` [Bug c++/98810] " rguenth at gcc dot gnu.org
  2021-02-12  4:51 ` [Bug c++/98810] [9/10/11 Regression] " mpolacek at gcc dot gnu.org
@ 2021-02-26  3:57 ` cvs-commit at gcc dot gnu.org
  2021-02-26  4:02 ` [Bug c++/98810] [9/10 " jason at gcc dot gnu.org
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-02-26  3:57 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jason Merrill <jason@gcc.gnu.org>:

https://gcc.gnu.org/g:7c657339d6a4a671b4cd8bc62ba4e0df6bfc7c72

commit r11-7416-g7c657339d6a4a671b4cd8bc62ba4e0df6bfc7c72
Author: Jason Merrill <jason@redhat.com>
Date:   Thu Feb 25 16:47:53 2021 -0500

    c++: Fix class NTTP constness handling [PR98810]

    Here, when substituting still-dependent args into an alias template, we see
    a non-const type because the default argument is non-const, and is not a
    template parm object because it's still dependent.

    gcc/cp/ChangeLog:

            PR c++/98810
            * pt.c (tsubst_copy) [VIEW_CONVERT_EXPR]: Add const
            to a class non-type template argument that needs it.

    gcc/testsuite/ChangeLog:

            PR c++/98810
            * g++.dg/cpp2a/nontype-class-defarg1.C: New test.

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

* [Bug c++/98810] [9/10 Regression] [C++20] ICE in tsubst_copy, at cp/pt.c:16771
  2021-01-24 20:31 [Bug c++/98810] New: [C++20] ICE in tsubst_copy, at cp/pt.c:16771 dimitri.gorokhovik at free dot fr
                   ` (2 preceding siblings ...)
  2021-02-26  3:57 ` cvs-commit at gcc dot gnu.org
@ 2021-02-26  4:02 ` jason at gcc dot gnu.org
  2021-03-04  4:49 ` cvs-commit at gcc dot gnu.org
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: jason at gcc dot gnu.org @ 2021-02-26  4:02 UTC (permalink / raw)
  To: gcc-bugs

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

Jason Merrill <jason at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
           Assignee|unassigned at gcc dot gnu.org      |jason at gcc dot gnu.org
            Summary|[9/10/11 Regression]        |[9/10 Regression] [C++20]
                   |[C++20] ICE in tsubst_copy, |ICE in tsubst_copy, at
                   |at cp/pt.c:16771            |cp/pt.c:16771

--- Comment #4 from Jason Merrill <jason at gcc dot gnu.org> ---
Fixed for GCC 11 so far.

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

* [Bug c++/98810] [9/10 Regression] [C++20] ICE in tsubst_copy, at cp/pt.c:16771
  2021-01-24 20:31 [Bug c++/98810] New: [C++20] ICE in tsubst_copy, at cp/pt.c:16771 dimitri.gorokhovik at free dot fr
                   ` (3 preceding siblings ...)
  2021-02-26  4:02 ` [Bug c++/98810] [9/10 " jason at gcc dot gnu.org
@ 2021-03-04  4:49 ` cvs-commit at gcc dot gnu.org
  2021-03-04  5:13 ` cvs-commit at gcc dot gnu.org
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-03-04  4:49 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-10 branch has been updated by Jason Merrill
<jason@gcc.gnu.org>:

https://gcc.gnu.org/g:bf49d83570ddb4df7893c3d605f7fc89db13792d

commit r10-9412-gbf49d83570ddb4df7893c3d605f7fc89db13792d
Author: Jason Merrill <jason@redhat.com>
Date:   Thu Feb 25 16:47:53 2021 -0500

    c++: Fix class NTTP constness handling [PR98810]

    Here, when substituting still-dependent args into an alias template, we see
    a non-const type because the default argument is non-const, and is not a
    template parm object because it's still dependent.

    gcc/cp/ChangeLog:

            PR c++/98810
            * pt.c (tsubst_copy) [VIEW_CONVERT_EXPR]: Add const
            to a class non-type template argument that needs it.

    gcc/testsuite/ChangeLog:

            PR c++/98810
            * g++.dg/cpp2a/nontype-class-defarg1.C: New test.

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

* [Bug c++/98810] [9/10 Regression] [C++20] ICE in tsubst_copy, at cp/pt.c:16771
  2021-01-24 20:31 [Bug c++/98810] New: [C++20] ICE in tsubst_copy, at cp/pt.c:16771 dimitri.gorokhovik at free dot fr
                   ` (4 preceding siblings ...)
  2021-03-04  4:49 ` cvs-commit at gcc dot gnu.org
@ 2021-03-04  5:13 ` cvs-commit at gcc dot gnu.org
  2021-03-05  9:13 ` clyon at gcc dot gnu.org
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-03-04  5:13 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-9 branch has been updated by Jason Merrill
<jason@gcc.gnu.org>:

https://gcc.gnu.org/g:89896df2cbfa52940c81858d9c4111633b533d25

commit r9-9265-g89896df2cbfa52940c81858d9c4111633b533d25
Author: Jason Merrill <jason@redhat.com>
Date:   Thu Feb 25 16:47:53 2021 -0500

    c++: Fix class NTTP constness handling [PR98810]

    Here, when substituting still-dependent args into an alias template, we see
    a non-const type because the default argument is non-const, and is not a
    template parm object because it's still dependent.

    gcc/cp/ChangeLog:

            PR c++/98810
            * pt.c (tsubst_copy) [VIEW_CONVERT_EXPR]: Add const
            to a class non-type template argument that needs it.

    gcc/testsuite/ChangeLog:

            PR c++/98810
            * g++.dg/cpp2a/nontype-class-defarg1.C: New test.

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

* [Bug c++/98810] [9/10 Regression] [C++20] ICE in tsubst_copy, at cp/pt.c:16771
  2021-01-24 20:31 [Bug c++/98810] New: [C++20] ICE in tsubst_copy, at cp/pt.c:16771 dimitri.gorokhovik at free dot fr
                   ` (5 preceding siblings ...)
  2021-03-04  5:13 ` cvs-commit at gcc dot gnu.org
@ 2021-03-05  9:13 ` clyon at gcc dot gnu.org
  2021-03-05 14:02 ` mpolacek at gcc dot gnu.org
  2021-04-05 21:43 ` jason at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: clyon at gcc dot gnu.org @ 2021-03-05  9:13 UTC (permalink / raw)
  To: gcc-bugs

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

Christophe Lyon <clyon at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |clyon at gcc dot gnu.org

--- Comment #7 from Christophe Lyon <clyon at gcc dot gnu.org> ---
Hi, the backport in gcc-9 branch is causing errors:

ERROR: g++.dg/cpp2a/nontype-class-defarg1.C  -std=c++14: syntax error in target
selector "target c++20" for " dg-do 2 compile { target c++20 } "

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

* [Bug c++/98810] [9/10 Regression] [C++20] ICE in tsubst_copy, at cp/pt.c:16771
  2021-01-24 20:31 [Bug c++/98810] New: [C++20] ICE in tsubst_copy, at cp/pt.c:16771 dimitri.gorokhovik at free dot fr
                   ` (6 preceding siblings ...)
  2021-03-05  9:13 ` clyon at gcc dot gnu.org
@ 2021-03-05 14:02 ` mpolacek at gcc dot gnu.org
  2021-04-05 21:43 ` jason at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2021-03-05 14:02 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #8 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
It probably needs target c++2a instead.

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

* [Bug c++/98810] [9/10 Regression] [C++20] ICE in tsubst_copy, at cp/pt.c:16771
  2021-01-24 20:31 [Bug c++/98810] New: [C++20] ICE in tsubst_copy, at cp/pt.c:16771 dimitri.gorokhovik at free dot fr
                   ` (7 preceding siblings ...)
  2021-03-05 14:02 ` mpolacek at gcc dot gnu.org
@ 2021-04-05 21:43 ` jason at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: jason at gcc dot gnu.org @ 2021-04-05 21:43 UTC (permalink / raw)
  To: gcc-bugs

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

Jason Merrill <jason at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|ASSIGNED                    |RESOLVED

--- Comment #9 from Jason Merrill <jason at gcc dot gnu.org> ---
Fixed for 9.4/10.3/11.

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

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

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-24 20:31 [Bug c++/98810] New: [C++20] ICE in tsubst_copy, at cp/pt.c:16771 dimitri.gorokhovik at free dot fr
2021-01-25  9:42 ` [Bug c++/98810] " rguenth at gcc dot gnu.org
2021-02-12  4:51 ` [Bug c++/98810] [9/10/11 Regression] " mpolacek at gcc dot gnu.org
2021-02-26  3:57 ` cvs-commit at gcc dot gnu.org
2021-02-26  4:02 ` [Bug c++/98810] [9/10 " jason at gcc dot gnu.org
2021-03-04  4:49 ` cvs-commit at gcc dot gnu.org
2021-03-04  5:13 ` cvs-commit at gcc dot gnu.org
2021-03-05  9:13 ` clyon at gcc dot gnu.org
2021-03-05 14:02 ` mpolacek at gcc dot gnu.org
2021-04-05 21:43 ` jason 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).