[Bug c++/71808] [concepts] ICE in finish_member_declaration
pinskia at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Thu Jul 22 22:54:33 GMT 2021
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71808
--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
GCC 10 and above don't ICE but errors out:
<source>: In instantiation of 'struct model<int>':
<source>:2:42: required from here
<source>:17:25: error: template constraint failure for 'template<class X>
requires Fooable<X> struct container'
17 | container<model<X>> bar() { return {}; }
| ^~~
<source>:17:25: note: constraints not satisfied
<source>:2:14: required for the satisfaction of 'Fooable<X>' [with X =
model<int>]
<source>:2:24: in requirements with 'X x' [with X = model<int>]
<source>:2:45: note: the required expression 'x.foo()' is invalid, because
2 | concept bool Fooable = requires(X x) { x.foo(); };
| ~~~~~^~
<source>:2:35: error: 'x' has incomplete type
2 | concept bool Fooable = requires(X x) { x.foo(); };
| ~~^
<source>:12:8: note: declaration of 'struct model<int>'
12 | struct model {
| ^~~~~
<source>: In function 'int main()':
<source>:22:38: error: 'struct model<int>' has no member named 'bar'
22 | container<model<int>> {}.payload.bar();
| ^~~
GCC 11/trunk:
<source>: In substitution of 'template<class X> requires Fooable<X> struct
container [with X = model<int>]':
<source>:17:25: required from 'struct model<int>'
<source>:2:42: required by substitution of 'template<class X> requires
Fooable<X> struct container [with X = model<int>]'
<source>:22:24: required from here
<source>:2:14: required for the satisfaction of 'Fooable<X>' [with X =
model<int>]
<source>:2:24: in requirements with 'X x' [with X = model<int>]
<source>:2:24: error: satisfaction of atomic constraint 'requires(X x)
{x.foo();} [with X = X]' depends on itself
2 | concept bool Fooable = requires(X x) { x.foo(); };
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
<source>: In instantiation of 'struct model<int>':
<source>:2:42: required by substitution of 'template<class X> requires
Fooable<X> struct container [with X = model<int>]'
<source>:22:24: required from here
<source>:17:25: error: template constraint failure for 'template<class X>
requires Fooable<X> struct container'
17 | container<model<X>> bar() { return {}; }
| ^~~
<source>:17:25: note: constraints not satisfied
<source>: In substitution of 'template<class X> requires Fooable<X> struct
container [with X = model<int>]':
<source>:17:25: required from 'struct model<int>'
<source>:2:42: required by substitution of 'template<class X> requires
Fooable<X> struct container [with X = model<int>]'
<source>:22:24: required from here
<source>:2:14: required for the satisfaction of 'Fooable<X>' [with X =
model<int>]
<source>:2:24: in requirements with 'X x' [with X = model<int>]
<source>:2:24: error: satisfaction of atomic constraint 'requires(X x)
{x.foo();} [with X = X]' depends on itself
2 | concept bool Fooable = requires(X x) { x.foo(); };
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
<source>: In function 'int main()':
<source>:22:38: error: 'struct model<int>' has no member named 'bar'
22 | container<model<int>> {}.payload.bar();
| ^~~
More information about the Gcc-bugs
mailing list