public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/105842] New: rejects-valid: static member function overload set constrained by concepts for class template results in ambiguous call
@ 2022-06-03 21:04 joeloser at fastmail dot com
  2022-06-06 12:39 ` [Bug c++/105842] " ppalka at gcc dot gnu.org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: joeloser at fastmail dot com @ 2022-06-03 21:04 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 105842
           Summary: rejects-valid: static member function overload set
                    constrained by concepts for class template results in
                    ambiguous call
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: joeloser at fastmail dot com
  Target Milestone: ---

In the following snippet,

```
#include <concepts>
#include <cstddef>

template<class>
struct S {
  static constexpr auto f(const std::unsigned_integral auto value) ->
std::size_t {
    return {};
  }
  static constexpr auto f(const std::signed_integral auto value) -> std::size_t
{
    return f(static_cast<std::size_t>(value));
  }
};
```

The second `f` overload results in a compilation error:

```
error: call of overloaded ‘f(std::size_t)’ is ambiguous
... list of the two candidates
```

This appears to be a GCC bug, but only if S is a class template (regardless of
whether the template parameter list is a type or a non-type). Note that clang
trunk compiles the code fine as-is. If `S` is a class and not a class template,
then GCC accepts the code.

See it live at https://godbolt.org/z/oddxEWGMv

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

end of thread, other threads:[~2022-07-27 21:02 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-03 21:04 [Bug c++/105842] New: rejects-valid: static member function overload set constrained by concepts for class template results in ambiguous call joeloser at fastmail dot com
2022-06-06 12:39 ` [Bug c++/105842] " ppalka at gcc dot gnu.org
2022-07-01 12:22 ` ppalka at gcc dot gnu.org
2022-07-13 18:03 ` cvs-commit at gcc dot gnu.org
2022-07-13 18:05 ` ppalka at gcc dot gnu.org
2022-07-21 16:48 ` cvs-commit at gcc dot gnu.org
2022-07-21 16:51 ` ppalka at gcc dot gnu.org
2022-07-27 21:02 ` joeloser at fastmail 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).