https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79994

--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
GCC 10 and above rejects reduced testcase in comment 1:
GCC 10:
<source>: In instantiation of 'void add(T&) [with T = Directed_Graph_impl]':
<source>:3:8:   recursively required from 'void add(T&) [with T =
Directed_Graph_impl]'
<source>:3:8:   required from 'void add(T&) [with T = Directed_Graph_impl]'
<source>:14:10:   required from here
<source>:3:8: fatal error: template instantiation depth exceeds maximum of 900
(use '-ftemplate-depth=' to increase the maximum)
    3 |     add(g);
      |     ~~~^~~

GCC 11/trunk:
<source>: In substitution of 'template<class T>  requires  Graph<T> void
add(T&) [with T = Directed_Graph_impl]':
<source>:3:8:   required by substitution of 'template<class T>  requires 
Graph<T> void add(T&) [with T = Directed_Graph_impl]'
<source>:14:8:   required from here
<source>:2:14:   required for the satisfaction of 'Graph<T>' [with T =
Directed_Graph_impl]
<source>:2:22:   in requirements with 'G& g' [with G = Directed_Graph_impl]
<source>:2:22: error: satisfaction of atomic constraint 'requires(G& g)
{add(g);} [with G = T]' depends on itself
    2 | concept bool Graph = requires (G& g) {
      |                      ^~~~~~~~~~~~~~~~~
    3 |     add(g);
      |     ~~~~~~~           
    4 | };
      | ~                     
<source>: In function 'int main()':
<source>:14:8: error: no matching function for call to
'add(Directed_Graph_impl&)'
   14 |     add(t);
      |     ~~~^~~
<source>:7:6: note: candidate: 'template<class T>  requires  Graph<T> void
add(T&)'
    7 | void add(T& g) {
      |      ^~~
<source>:7:6: note:   substitution of deduced template arguments resulted in
errors seen above

Reply via email to