[Bug c++/79994] Concepts technical specification

ensadc at mailnesia dot com gcc-bugzilla@gcc.gnu.org
Sat Oct 21 07:41:00 GMT 2017


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 <typename G>
concept bool Graph = requires (G& g) {
    add(g);
};

template <Graph T>
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.


More information about the Gcc-bugs mailing list