[Bug c++/79994] Concepts technical specification

2021-07-22 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79994

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

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

[Bug c++/79994] Concepts technical specification

2017-10-21 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79994

Jonathan Wakely  changed:

   What|Removed |Added

   Keywords||ice-on-invalid-code
 Status|UNCONFIRMED |NEW
   Last reconfirmed||2017-10-21
 Ever confirmed|0   |1

--- Comment #2 from Jonathan Wakely  ---
I *think* this is invalid, but I'm not sure.

[Bug c++/79994] Concepts technical specification

2017-10-21 Thread ensadc at mailnesia dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79994

ensadc at mailnesia dot com changed:

   What|Removed |Added

 CC||ensadc at mailnesia dot com

--- Comment #1 from ensadc at mailnesia dot com ---
Simplified:

template 
concept bool Graph = requires (G& g) {
add(g);
};

template 
void add(T& g) {
};

class Directed_Graph_impl {};

int main() {
Directed_Graph_impl t;
add(t);
}

The problem seems to be that the instantiation of `add` requires the
instantiation of `Graph` concept, but the latter, in turn, requires the former.
This leads to an infinite recursion and eventually causes segfault.