https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93729
Bug ID: 93729
Summary: [concepts] binding bit-field to lvalue reference in
requires expression should be SFINAE
Product: gcc
Version: 10.0
Status: UNCONFIRMED
Keywords: rejects-valid
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: kretz at kde dot org
Target Milestone: ---
Test case (https://godbolt.org/z/VaSCCA):
template <class T> concept foo =
requires(T& x, void(fun)(int &)) { fun(x.a); };
struct A {
int a, b;
};
struct B {
int a : 4;
int b : 4;
};
bool a = foo<A>;
bool b = foo<B>;
GCC 10.0.1 20200212 errors out with: "error: cannot bind bit-field 'x.B::a' to
'int&'". Since this error only happens when substituting B for T in foo<T>,
this should not be ill-formed and foo<B> thus needs to be false.