public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/96355] New: [concepts] internal compiler error: in tsubst_pack_expansion, at cp/pt.c:12928
@ 2020-07-28 12:45 src at andyf dot de
  2020-08-18 21:01 ` [Bug c++/96355] " rwdougla at gmail dot com
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: src at andyf dot de @ 2020-07-28 12:45 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 96355
           Summary: [concepts] internal compiler error: in
                    tsubst_pack_expansion, at cp/pt.c:12928
           Product: gcc
           Version: 10.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: src at andyf dot de
  Target Milestone: ---

The following code (https://godbolt.org/z/edTK48) causes an internal compiler
error:

template<typename... Args>
requires requires
{
   requires sizeof...(Args) > 1;
}
auto add(const Args&... args)
{
   return (... + args);
}

int main()
{
   return add(2, 3, 4);
}


The error is:
<source>: In instantiation of 'auto add(const Args& ...) [with Args = {int,
int, int}]':
<source>:13:22:   required from here
<source>:4:13: internal compiler error: in tsubst_pack_expansion, at
cp/pt.c:12922
    4 |    requires sizeof...(Args) > 1;
      |             ^~~~~~~~~~~~~~~

Please submit a full bug report,
with preprocessed source if appropriate.
See <https://gcc.gnu.org/bugs/> for instructions.



With g++ 10.1 on godbolt there is no internal compiler error, but the compiler
concludes

<source>:4:29: note: nested requirement '(sizeof... (Args) > 1)' is not
satisfied

which is also wrong. However, the behavior seems to have changed with 10.2.0
and exists in trunk (20200727). The code compiles, if I move the requirement
directly into the requires-clause:

template<typename... Args>
requires(sizeof...(Args) > 1)
auto add(const Args&... args)
{
   return (... + args);
}

This version even produces the correct result. I suspect the error is in the
path of the nested requirement.

The failing code compiles with clang 10.0.0 and MSVC 19.24.


Cheers,
   Andreas

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

* [Bug c++/96355] [concepts] internal compiler error: in tsubst_pack_expansion, at cp/pt.c:12928
  2020-07-28 12:45 [Bug c++/96355] New: [concepts] internal compiler error: in tsubst_pack_expansion, at cp/pt.c:12928 src at andyf dot de
@ 2020-08-18 21:01 ` rwdougla at gmail dot com
  2020-08-27 12:47 ` [Bug c++/96355] [10/11 Regression] " redi at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: rwdougla at gmail dot com @ 2020-08-18 21:01 UTC (permalink / raw)
  To: gcc-bugs

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

Robert Douglas <rwdougla at gmail dot com> changed:

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

--- Comment #1 from Robert Douglas <rwdougla at gmail dot com> ---
I've also hit this issue in upgrading from 9.1 to 10.2

I presume it run into the same issue, but if it helps, this more closely
matches my use case:
https://godbolt.org/z/zb1bP5

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

* [Bug c++/96355] [10/11 Regression] [concepts] internal compiler error: in tsubst_pack_expansion, at cp/pt.c:12928
  2020-07-28 12:45 [Bug c++/96355] New: [concepts] internal compiler error: in tsubst_pack_expansion, at cp/pt.c:12928 src at andyf dot de
  2020-08-18 21:01 ` [Bug c++/96355] " rwdougla at gmail dot com
@ 2020-08-27 12:47 ` redi at gcc dot gnu.org
  2020-08-27 12:47 ` redi at gcc dot gnu.org
  2020-10-07 18:55 ` ppalka at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: redi at gcc dot gnu.org @ 2020-08-27 12:47 UTC (permalink / raw)
  To: gcc-bugs

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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to work|                            |10.1.0
            Summary|[concepts] internal         |[10/11 Regression]
                   |compiler error: in          |[concepts] internal
                   |tsubst_pack_expansion, at   |compiler error: in
                   |cp/pt.c:12928               |tsubst_pack_expansion, at
                   |                            |cp/pt.c:12928
   Last reconfirmed|                            |2020-08-27
             Status|UNCONFIRMED                 |NEW
      Known to fail|                            |10.2.0, 11.0
     Ever confirmed|0                           |1
   Target Milestone|---                         |10.3

--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Comment 0 compiles with GCC 9 and -std=c++2a -fconcepts

rejects-valid with GCC 10.1 and -std=c++2a

ice-on-valid-code with GCC 10.2.0, 10.2.1 and 11.0 with -std=c++2a

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

* [Bug c++/96355] [10/11 Regression] [concepts] internal compiler error: in tsubst_pack_expansion, at cp/pt.c:12928
  2020-07-28 12:45 [Bug c++/96355] New: [concepts] internal compiler error: in tsubst_pack_expansion, at cp/pt.c:12928 src at andyf dot de
  2020-08-18 21:01 ` [Bug c++/96355] " rwdougla at gmail dot com
  2020-08-27 12:47 ` [Bug c++/96355] [10/11 Regression] " redi at gcc dot gnu.org
@ 2020-08-27 12:47 ` redi at gcc dot gnu.org
  2020-10-07 18:55 ` ppalka at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: redi at gcc dot gnu.org @ 2020-08-27 12:47 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Robert Douglas from comment #1)
> I've also hit this issue in upgrading from 9.1 to 10.2
> 
> I presume it run into the same issue, but if it helps, this more closely
> matches my use case:
> https://godbolt.org/z/zb1bP5

That code:

template<typename... Params>
concept ParamsRemain = requires(Params)
{ requires sizeof...(Params) > 0; };

template<typename... Params>
void foo()
{
        static constexpr bool pr1 = ParamsRemain<Params...>;
};

int main()
{
        foo<>();
        return 0;
}

compiles with GCC 9 and -std=c++2a -fconcepts

compiles with GCC 10.1 and -std=c++2a

ice-on-valid-code with GCC 10.2.0, 10.2.1 and 11.0 with -std=c++2a

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

* [Bug c++/96355] [10/11 Regression] [concepts] internal compiler error: in tsubst_pack_expansion, at cp/pt.c:12928
  2020-07-28 12:45 [Bug c++/96355] New: [concepts] internal compiler error: in tsubst_pack_expansion, at cp/pt.c:12928 src at andyf dot de
                   ` (2 preceding siblings ...)
  2020-08-27 12:47 ` redi at gcc dot gnu.org
@ 2020-10-07 18:55 ` ppalka at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: ppalka at gcc dot gnu.org @ 2020-10-07 18:55 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |DUPLICATE
                 CC|                            |ppalka at gcc dot gnu.org
             Status|NEW                         |RESOLVED

--- Comment #4 from Patrick Palka <ppalka at gcc dot gnu.org> ---
Looks like trunk now accepts the testcases in #c0 and #c3.  I think this is the
same issue as PR96531, thus marking this PR as a dup.

*** This bug has been marked as a duplicate of bug 96531 ***

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

end of thread, other threads:[~2020-10-07 18:55 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-28 12:45 [Bug c++/96355] New: [concepts] internal compiler error: in tsubst_pack_expansion, at cp/pt.c:12928 src at andyf dot de
2020-08-18 21:01 ` [Bug c++/96355] " rwdougla at gmail dot com
2020-08-27 12:47 ` [Bug c++/96355] [10/11 Regression] " redi at gcc dot gnu.org
2020-08-27 12:47 ` redi at gcc dot gnu.org
2020-10-07 18:55 ` ppalka 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).