[Bug c++/96355] New: [concepts] internal compiler error: in tsubst_pack_expansion, at cp/pt.c:12928
src at andyf dot de
gcc-bugzilla@gcc.gnu.org
Tue Jul 28 12:45:23 GMT 2020
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
More information about the Gcc-bugs
mailing list