https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82794
Bug ID: 82794
Summary: ICE: Cannot allocate memory for concept with default
argument
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: victor.nicolae.savu at gmail dot com
Target Milestone: ---
Here is the reproduction on godbolt: https://godbolt.org/g/Ag8aqs
When I try to define a concept with two template arguments where latter depends
on the former:
> code: -----------------------------
template<typename F, typename G = F>
concept bool Foo = true;
template<Foo fun>
using foo = void;
> -----------------------------------
I get the following error:
> 4 : <source>:4:10: internal compiler error: in tsubst, at cp/pt.c:13607
> template<Foo fun>
> ^~~
mmap: Cannot allocate memory
Compiler version:
> x86-64 GCC 7.2
Compiler flags:
> -fconcepts
It seems that it doesn't really matter what template we are defining. I went
for a generic using statement just for the simple reproduction, but foo could
be a function or a class and the same problem occurs.
The problem seems to stem from the `typename G = F` part. Variations such as
`typename G = typename F::associated` also fail.
Replacing that by `typename G` results in a valid compilation error, while
replacing by `typename G = int` leads to successful compilation (as expected).
Please let me know if there is any other information that I need to provide.