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

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).