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

--- Comment #2 from Igel <ich.freak at gmx dot net> ---
Ah thanks for copying the relevant code here. The error that you're referring
to is:

<source>: In instantiation of 'struct X<0>':
<source>:5:14:   required by substitution of 'template<class N>  requires 
StrictNodeType<N> using Int = int [with N = X<0>]'
<source>:15:27:   required from here
<source>:12:11: error: template constraint failure for 'template<class N> 
requires  StrictNodeType<N> using Int = int'
   12 |     using something = Int<X>;
      |           ^~~~~~~~~
<source>:12:11: note: constraints not satisfied


I guess technically, you're right that it points to the correct spot and it is
the programmers duty to translate this into
"the concept StrictNodeType<X<0>> depends on itself because the type
X<0>::something (also known as Int<X<0>>) declared in line 12 depends on the
concept StrictNodeType<X<0>>".
However, this information can be buried arbitrarily deep in the error messages.
Consider, for example, the following adaptation:

#include <type_traits>

template<typename N>
concept StrictNodeType = requires {
    typename N::something;
};

template<StrictNodeType N> using Int = int; 

template<template<class> class P, class Q>
using chooser = P<Q>;

template<int>
struct X { using something = chooser<Int, X>; };

using ThisBreaks = Int<X<0>>;


The only hint towards the real problem (gcc cannot tell if X<0> has a type
called 'something' or not) is now this:
<source>:14:18:   required from 'struct X<0>'

I guess all I'm saying is that extracting the site of the problematic code is
currently very hard for "depends on itself"-errors.

Reply via email to