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

            Bug ID: 103783
           Summary: Ambiguous overload between constrained static member
                    and unconstrained non-static member
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: barry.revzin at gmail dot com
  Target Milestone: ---

>From StackOverflow (https://stackoverflow.com/q/70429541/2069064):

template<bool b>
struct s {
    void f() const;
    static void f() requires b;
};

void g() {
    s<true>().f();
}

gcc rejects with:

<source>: In function 'void g()':
<source>:8:20: error: call of overloaded 'f()' is ambiguous
    8 |         s<true>().f();
      |         ~~~~~~~~~~~^~
<source>:3:14: note: candidate: 'void s<b>::f() const [with bool b = true]'
    3 |         void f() const;
      |              ^
<source>:4:21: note: candidate: 'static void s<b>::f() requires  b [with bool b
= true]'
    4 |         static void f() requires b;
      |                     ^

I don't think this is an instance of P2113 with non-equivalent templates, seems
like this case should compile. clang and msvc accept.

Reply via email to