public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/99963] New: [concepts] template <concept> vs concept auto reports ambiguous overload
@ 2021-04-07 20:02 ldalessandro at gmail dot com
  2021-04-14 15:41 ` [Bug c++/99963] [11 Regression] " ppalka at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: ldalessandro at gmail dot com @ 2021-04-07 20:02 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 99963
           Summary: [concepts] template <concept> vs concept auto reports
                    ambiguous overload
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ldalessandro at gmail dot com
  Target Milestone: ---

Consider the following code (https://godbolt.org/z/h1bz1qxan).

#include <concepts>

struct A{};
struct B : A {};

template <class T> 
concept is_a = std::is_base_of_v<A, T>;

template <class T>
concept is_b = is_a<T> and std::same_as<B, T>;

int foo(is_a auto, is_a auto);

#ifdef OK
int foo(is_b auto, is_a auto);
#else
template <is_a A>
int foo(is_b auto, A);
#endif

A a;
B b;
int d = foo(b, a);

<source>:23:12: error: call of overloaded 'foo(B&, A&)' is ambiguous
   23 | int d = foo(b, a);
      |         ~~~^~~~~~

With -DOK, which enables is_a auto syntax, this compiles. The template <is_a>
fails.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2022-06-23 18:47 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-07 20:02 [Bug c++/99963] New: [concepts] template <concept> vs concept auto reports ambiguous overload ldalessandro at gmail dot com
2021-04-14 15:41 ` [Bug c++/99963] [11 Regression] " ppalka at gcc dot gnu.org
2021-04-14 19:12 ` jason at gcc dot gnu.org
2021-04-15 14:26 ` ldalessandro at gmail dot com
2022-06-21 21:21 ` tabloid.adroit at gmail dot com
2022-06-23 18:47 ` tabloid.adroit at gmail dot com

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).