https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81717
Andrew Pinski <pinskia at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Target Milestone|--- |11.0 Resolution|--- |FIXED Status|UNCONFIRMED |RESOLVED Keywords| |ice-on-invalid-code --- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> --- In GCC 9.2.0 and above I get: <source>: In instantiation of 'bool foo(T) [with T = A]': <source>:14:32: recursively required from 'bool foo(T) [with T = A]' <source>:14:32: required from 'bool foo(T) [with T = A]' <source>:23:8: required from here <source>:14:32: fatal error: template instantiation depth exceeds maximum of 900 (use '-ftemplate-depth=' to increase the maximum) 14 | requires !requires(T a) { { foo(a) } -> bool } | ~~~^~~ With GCC 11 and above giving (after adding a semicolon after the bool): <source>: In substitution of 'template<class T> requires !requires(T a) {{foo()(a)} -> bool;} bool foo(T) [with T = B]': <source>:14:32: required by substitution of 'template<class T> requires !requires(T a) {{foo()(a)} -> bool;} bool foo(T) [with T = B]' <source>:24:6: required from here <source>:15:6: required by the constraints of 'template<class T> requires !requires(T a) {{foo()(a)} -> bool;} bool foo(T)' <source>:14:10: error: satisfaction of atomic constraint '!requires(T a) {{foo()(a)} -> bool;} [with T = T]' depends on itself 14 | requires !requires(T a) { { foo(a) } -> bool; } | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ So fixed in GCC 11.