[Bug c++/105220] Incorrect concept evaluation when friend class is involved
ppalka at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Mon Apr 11 15:17:27 GMT 2022
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105220
Patrick Palka <ppalka at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |ASSIGNED
Last reconfirmed| |2022-04-11
Assignee|unassigned at gcc dot gnu.org |ppalka at gcc dot gnu.org
CC| |ppalka at gcc dot gnu.org
Ever confirmed|0 |1
Known to fail| |10.3.0, 11.2.0, 12.0
--- Comment #1 from Patrick Palka <ppalka at gcc dot gnu.org> ---
Confirmed, reduced rejects-valid testcase:
template<class T>
concept fooable = requires(T t) { t.foo(); };
template<class>
struct A; // #1
template<fooable T>
struct A<T> { }; // #2
struct B {
private:
friend struct A<B>;
void foo();
};
A<B> a; // should use #2
When determining whether to use #1 or #2 for A<B>, we check #2's constraints in
the context of the template rather than the context of the specialization, so
the friend declaration doesn't apply. Thus one workaround is to declare a
template friend instead:
template<class> friend struct A;
More information about the Gcc-bugs
mailing list