public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/97052] New: Internal compiler error with substitution failure in template parameter list of concept declaration
@ 2020-09-15  1:42 david at doublewise dot net
  2020-09-15  1:45 ` [Bug c++/97052] " mpolacek at gcc dot gnu.org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: david at doublewise dot net @ 2020-09-15  1:42 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 97052
           Summary: Internal compiler error with substitution failure in
                    template parameter list of concept declaration
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: david at doublewise dot net
  Target Milestone: ---

The following code

```
template<typename T, typename U = typename T::type>
concept foo = true;

constexpr bool f(foo auto) {
        return false;
}

constexpr bool f(int) {
        return true;
}

static_assert(f(0));
```

fails to compile with

```
<source>:4:18: internal compiler error: in dependent_type_p, at cp/pt.c:26440

    4 | constexpr bool f(foo auto) {

      |                  ^~~

Please submit a full bug report,

with preprocessed source if appropriate.

See <https://gcc.gnu.org/bugs/> for instructions.

Compiler returned: 1
```



See it live: https://godbolt.org/z/EjEePo

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

* [Bug c++/97052] Internal compiler error with substitution failure in template parameter list of concept declaration
  2020-09-15  1:42 [Bug c++/97052] New: Internal compiler error with substitution failure in template parameter list of concept declaration david at doublewise dot net
@ 2020-09-15  1:45 ` mpolacek at gcc dot gnu.org
  2020-10-01 17:32 ` david at doublewise dot net
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2020-09-15  1:45 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2020-09-15
             Status|UNCONFIRMED                 |NEW
           Keywords|                            |ice-on-valid-code
     Ever confirmed|0                           |1
                 CC|                            |mpolacek at gcc dot gnu.org

--- Comment #1 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Confirmed.

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

* [Bug c++/97052] Internal compiler error with substitution failure in template parameter list of concept declaration
  2020-09-15  1:42 [Bug c++/97052] New: Internal compiler error with substitution failure in template parameter list of concept declaration david at doublewise dot net
  2020-09-15  1:45 ` [Bug c++/97052] " mpolacek at gcc dot gnu.org
@ 2020-10-01 17:32 ` david at doublewise dot net
  2020-10-07 19:38 ` ppalka at gcc dot gnu.org
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: david at doublewise dot net @ 2020-10-01 17:32 UTC (permalink / raw)
  To: gcc-bugs

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

David Stone <david at doublewise dot net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |david at doublewise dot net

--- Comment #2 from David Stone <david at doublewise dot net> ---
Turns out the substitution failure is a red herring. Here is a simpler
reproduction:

```
template<typename T, typename U = typename T::type>
concept foo = true;

void f(foo auto) {
}
```

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

* [Bug c++/97052] Internal compiler error with substitution failure in template parameter list of concept declaration
  2020-09-15  1:42 [Bug c++/97052] New: Internal compiler error with substitution failure in template parameter list of concept declaration david at doublewise dot net
  2020-09-15  1:45 ` [Bug c++/97052] " mpolacek at gcc dot gnu.org
  2020-10-01 17:32 ` david at doublewise dot net
@ 2020-10-07 19:38 ` ppalka at gcc dot gnu.org
  2020-10-08  4:06 ` cvs-commit at gcc dot gnu.org
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: ppalka at gcc dot gnu.org @ 2020-10-07 19:38 UTC (permalink / raw)
  To: gcc-bugs

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

Patrick Palka <ppalka at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
           Assignee|unassigned at gcc dot gnu.org      |ppalka at gcc dot gnu.org
                 CC|                            |ppalka at gcc dot gnu.org

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

* [Bug c++/97052] Internal compiler error with substitution failure in template parameter list of concept declaration
  2020-09-15  1:42 [Bug c++/97052] New: Internal compiler error with substitution failure in template parameter list of concept declaration david at doublewise dot net
                   ` (2 preceding siblings ...)
  2020-10-07 19:38 ` ppalka at gcc dot gnu.org
@ 2020-10-08  4:06 ` cvs-commit at gcc dot gnu.org
  2021-04-20 16:09 ` cvs-commit at gcc dot gnu.org
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-10-08  4:06 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

commit r11-3714-gc1c62aec6751678e958ab5c61b2d903a09d7efd9
Author: Patrick Palka <ppalka@redhat.com>
Date:   Thu Oct 8 00:05:41 2020 -0400

    c++: ICE in dependent_type_p with constrained auto [PR97052]

    This patch fixes an "unguarded" call to coerce_template_parms in
    build_standard_check: processing_template_decl could be zero if we
    get here during processing of the first 'auto' parameter of an
    abbreviated function template, or if we're processing the type
    constraint of a non-templated variable.  In the testcase below, this
    leads to an ICE when coerce_template_parms instantiates C's dependent
    default template argument.

    gcc/cp/ChangeLog:

            PR c++/97052
            * constraint.cc (build_type_constraint): Temporarily increment
            processing_template_decl before calling build_concept_check.
            * pt.c (make_constrained_placeholder_type): Likewise.

    gcc/testsuite/ChangeLog:

            PR c++/97052
            * g++.dg/cpp2a/concepts-defarg2.C: New test.

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

* [Bug c++/97052] Internal compiler error with substitution failure in template parameter list of concept declaration
  2020-09-15  1:42 [Bug c++/97052] New: Internal compiler error with substitution failure in template parameter list of concept declaration david at doublewise dot net
                   ` (3 preceding siblings ...)
  2020-10-08  4:06 ` cvs-commit at gcc dot gnu.org
@ 2021-04-20 16:09 ` cvs-commit at gcc dot gnu.org
  2021-04-20 16:11 ` ppalka at gcc dot gnu.org
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-04-20 16:09 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-10 branch has been updated by Patrick Palka
<ppalka@gcc.gnu.org>:

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

commit r10-9735-gebb734aac092cc1ea1208b3a96cc2b6ad85cf5a1
Author: Patrick Palka <ppalka@redhat.com>
Date:   Tue Apr 20 12:06:37 2021 -0400

    c++: ICE in dependent_type_p with constrained auto [PR97052]

    This patch fixes an "unguarded" call to coerce_template_parms in
    build_standard_check: processing_template_decl could be zero if we
    get here during processing of the first 'auto' parameter of an
    abbreviated function template, or if we're processing the type
    constraint of a non-templated variable.  In the testcase below, this
    leads to an ICE when coerce_template_parms instantiates C's dependent
    default template argument.

    gcc/cp/ChangeLog:

            PR c++/97052
            * constraint.cc (build_type_constraint): Temporarily increment
            processing_template_decl before calling build_concept_check.
            * pt.c (make_constrained_placeholder_type): Likewise.

    gcc/testsuite/ChangeLog:

            PR c++/97052
            * g++.dg/cpp2a/concepts-defarg2.C: New test.

    (cherry picked from commit c1c62aec6751678e958ab5c61b2d903a09d7efd9)

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

* [Bug c++/97052] Internal compiler error with substitution failure in template parameter list of concept declaration
  2020-09-15  1:42 [Bug c++/97052] New: Internal compiler error with substitution failure in template parameter list of concept declaration david at doublewise dot net
                   ` (4 preceding siblings ...)
  2021-04-20 16:09 ` cvs-commit at gcc dot gnu.org
@ 2021-04-20 16:11 ` ppalka at gcc dot gnu.org
  2021-04-20 16:12 ` ppalka at gcc dot gnu.org
  2022-11-13 20:02 ` pinskia at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: ppalka at gcc dot gnu.org @ 2021-04-20 16:11 UTC (permalink / raw)
  To: gcc-bugs

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

Patrick Palka <ppalka at gcc dot gnu.org> changed:

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

--- Comment #5 from Patrick Palka <ppalka at gcc dot gnu.org> ---
Fixed for GCC 10.4/11.

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

* [Bug c++/97052] Internal compiler error with substitution failure in template parameter list of concept declaration
  2020-09-15  1:42 [Bug c++/97052] New: Internal compiler error with substitution failure in template parameter list of concept declaration david at doublewise dot net
                   ` (5 preceding siblings ...)
  2021-04-20 16:11 ` ppalka at gcc dot gnu.org
@ 2021-04-20 16:12 ` ppalka at gcc dot gnu.org
  2022-11-13 20:02 ` pinskia at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: ppalka at gcc dot gnu.org @ 2021-04-20 16:12 UTC (permalink / raw)
  To: gcc-bugs

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

Patrick Palka <ppalka at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |10.4

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

* [Bug c++/97052] Internal compiler error with substitution failure in template parameter list of concept declaration
  2020-09-15  1:42 [Bug c++/97052] New: Internal compiler error with substitution failure in template parameter list of concept declaration david at doublewise dot net
                   ` (6 preceding siblings ...)
  2021-04-20 16:12 ` ppalka at gcc dot gnu.org
@ 2022-11-13 20:02 ` pinskia at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-11-13 20:02 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |wjwray at gmail dot com

--- Comment #6 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
*** Bug 107662 has been marked as a duplicate of this bug. ***

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

end of thread, other threads:[~2022-11-13 20:02 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-15  1:42 [Bug c++/97052] New: Internal compiler error with substitution failure in template parameter list of concept declaration david at doublewise dot net
2020-09-15  1:45 ` [Bug c++/97052] " mpolacek at gcc dot gnu.org
2020-10-01 17:32 ` david at doublewise dot net
2020-10-07 19:38 ` ppalka at gcc dot gnu.org
2020-10-08  4:06 ` cvs-commit at gcc dot gnu.org
2021-04-20 16:09 ` cvs-commit at gcc dot gnu.org
2021-04-20 16:11 ` ppalka at gcc dot gnu.org
2021-04-20 16:12 ` ppalka at gcc dot gnu.org
2022-11-13 20:02 ` pinskia 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).