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

            Bug ID: 105220
           Summary: Incorrect concept evaluation when friend class is
                    involved
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: martin.koch at bachmann dot info
  Target Milestone: ---

Assume we have a concept which checks whether a type implements a method foo:
template <typename T>
concept fooable = requires(const T &t) {
    t.foo();
};

And a class makes use of this concept:
template <typename T>
requires fooable<T>
struct A<T> { ... }

And some other class declares A as a friend:
class B {
   private:
    friend struct A<B>;
    void foo() const {
        std::cout << "foo called" << std::endl;
    }
};

In this case B is not considered "fooable" in the template specialization of
A<B>.
With clang it works fine. See: https://godbolt.org/z/8qWrPfd4b
  • [Bug c++/105220] New: Incorr... martin.koch at bachmann dot info via Gcc-bugs

Reply via email to