When I try to compile the following code:
struct A {
void foo() & {
}
};
int main()
{
using F = void() &; // or 'typedef void F() &;'
[[maybe_unused]] F A::*pf = &A::foo;
}
with clang this compiles, but when compiled with gcc it produces an error.
test.cc:9:37: error: cannot convert ‘void (A::*)() &’ to ‘void (A::*)()’ in initialization
9 | [[maybe_unused]] F A::*pf = &A::foo;
Which behavior is correct?