https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79318
--- Comment #3 from Jonathan Wakely ---
This seems to be http://wg21.link/cwg1726
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79318
--- Comment #2 from Jakub Jelinek ---
Smaller testcase:
struct A
{
int a;
A () : a(0) {};
&operator int () { return a; };
};
int
bar ()
{
A a;
return a;
}
clang++ indeed reports:
pr79318.C:5:3: error: cannot specify any part of a retu
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79318
--- Comment #1 from John Simon ---
Full example:
#include
using namespace std;
class Foo
{
private:
int a;
public:
Foo():a(0){};
&operator int() {return a;}; // this fails with Clang
};
int main()
{
Foo foo;
int x