public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "the_gamester28 at msn dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/99599] [11 Regression] Concepts requirement falsely reporting cyclic dependency, breaks tag_invoke pattern
Date: Mon, 05 Apr 2021 19:49:29 +0000	[thread overview]
Message-ID: <bug-99599-4-pxcoHqQJIl@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-99599-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #4 from the_gamester28 at msn dot com ---
(In reply to Jason Merrill from comment #2)
> (In reply to the_gamester28 from comment #0)
> > It seems that the template requirements of invoke_tag(bar_tag, int) are
> > considered while evaluating line marked "here". Requirements of irrelevant
> > overloads should not be considered, as it can potentially lead to falsely
> > reporting a cyclic dependency.
> 
> This is as specified by http://wg21.link/cwg2369
> 
> I think it would be reasonable to allow a compiler to accept the testcase
> under a generalization of 13.9.1/9: "If the function selected by overload
> resolution (12.4) can be determined without instantiating a class template
> definition, it is unspecified whether that instantiation actually takes
> place."
> 
> But that does not require a compiler to accept it.
> 
> It might make sense to check non-dependent conversions that don't require
> template instantiation, then constraints, then non-dependent conversions
> that do require template instantiation.  But that's a matter for the
> committee; G++ is conforming to the current working paper.

Perhaps I was too quick to assert what I expected the implementation details to
be.

The fooable<T> concept should be satisfied for any (T it) for which
invoke_tag(foo_tag{}, it) is unambiguously applicable. The fact that the
invoke_tag(bar_tag, T) overload exists should not preclude that. It is not up
to me how the compiler comes to that end, but that is the desired outcome.

It is still possible to ban recursive constraints, keep the new GCC 11
implementation, and still have this particular code compile with a small
alteration in behaviour:

The compiler does not immediately bail out as soon as it sees recursion in an
overload candidate, but marks that particular candidate as invalid.

If there are no applicable overloads (because they are all recursive, or they
are invalid for some other reason), then the compiler can reject the code and
list all of the reasons why all of the candidates are invalid.

In this case, it would mark invoke_tag(bar_tag, int) as not-applicable due to
the constraint recursion, and carry on checking the rest of the overloads for
applicability, until it is sure that there is one and only one applicable
overload: invoke_tag(foo_tag, int).

  parent reply	other threads:[~2021-04-05 19:49 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-15 13:24 [Bug c++/99599] New: Concepts requirement falsely reporting recursion, " the_gamester28 at msn dot com
2021-03-15 13:49 ` [Bug c++/99599] [11 Regression] Concepts requirement falsely reporting cyclic dependency, " rguenth at gcc dot gnu.org
2021-03-15 14:20 ` redi at gcc dot gnu.org
2021-04-01 22:04 ` jason at gcc dot gnu.org
2021-04-02 12:47 ` gcc-bugs at marehr dot dialup.fu-berlin.de
2021-04-05 19:49 ` the_gamester28 at msn dot com [this message]
2021-04-27 11:40 ` [Bug c++/99599] [11/12 " jakub at gcc dot gnu.org
2021-05-01 17:38 ` ppalka at gcc dot gnu.org
2021-07-28  7:06 ` rguenth at gcc dot gnu.org
2021-08-25 14:44 ` ppalka at gcc dot gnu.org
2022-04-21  7:48 ` rguenth at gcc dot gnu.org
2022-08-08 15:06 ` [Bug c++/99599] [11/12/13 " ppalka at gcc dot gnu.org
2022-10-27 12:42 ` ppalka at gcc dot gnu.org
2023-04-04  5:33 ` catsith at me dot com
2023-05-29 10:04 ` [Bug c++/99599] [11/12/13/14 " jakub at gcc dot gnu.org
2023-06-07 18:25 ` danakj at orodu dot net
2023-06-07 18:41 ` danakj at orodu dot net
2023-06-07 20:03 ` danakj at orodu dot net
2023-08-01 18:16 ` ppalka at gcc dot gnu.org
2023-09-08 16:03 ` cvs-commit at gcc dot gnu.org
2024-02-02 18:02 ` [Bug c++/99599] [11/12/13 " ppalka at gcc dot gnu.org
2024-03-09 15:37 ` ppalka at gcc dot gnu.org
2024-03-21 21:40 ` redi at gcc dot gnu.org
2024-03-21 21:43 ` redi at gcc dot gnu.org
2024-03-22 14:08 ` ppalka at gcc dot gnu.org
2024-03-22 15:58 ` redi at gcc dot gnu.org
2024-03-27 23:16 ` redi at gcc dot gnu.org
2024-03-27 23:18 ` redi at gcc dot gnu.org

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-99599-4-pxcoHqQJIl@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).