public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "ich.freak at gmx dot net" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/103540] diagnosting concept depends on itself
Date: Sun, 05 Dec 2021 16:04:26 +0000	[thread overview]
Message-ID: <bug-103540-4-laBghBYIow@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-103540-4@http.gcc.gnu.org/bugzilla/>

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.

      parent reply	other threads:[~2021-12-05 16:04 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-03 14:05 [Bug c++/103540] New: " ich.freak at gmx dot net
2021-12-03 22:10 ` [Bug c++/103540] " redi at gcc dot gnu.org
2021-12-05 16:04 ` ich.freak at gmx dot net [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-103540-4-laBghBYIow@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).