[Bug c++/103540] New: diagnosting concept depends on itself
ich.freak at gmx dot net
gcc-bugzilla@gcc.gnu.org
Fri Dec 3 14:05:27 GMT 2021
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103540
Bug ID: 103540
Summary: diagnosting concept depends on itself
Product: gcc
Version: 11.2.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: ich.freak at gmx dot net
Target Milestone: ---
When a concept X is checked for a template parameter T, this parameter is fully
instanciated.
(while this may not be necessary to check the concept, this seems to be
dictated by the standard if I understood correctly)
If the instanciation of T depends on the concept X<T>, then gcc refuses to
compile the code saying something like
"satisfaction of atomic constraint X<T> depends on itself".
If T is large, however, it may be very difficult to determine where exactly T
depends on X<T> and gcc currently does not help at all to find the problem.
It would be nice if gcc could tell the reader something like "X<T> depends on
itself because the type T::something declared in line Z depends on X<T>"
I prepared a small example here <https://godbolt.org/z/q9KczYb16>. Note that
diagnostics end with
<source>:5:14: note: the required type 'typename N::something' is invalid,
because
5 | typename N::something;
| ~~~~~~~~~^~~~~~~~~~~~~
Compiler returned: 1
leaving the reader to wonder "because of what?"
More information about the Gcc-bugs
mailing list