https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79318
--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
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 return type in the
declaration of a conversion function; put the complete type after 'operator'
&operator int () { return a; };
^
&
[dcl.dcl]/12 indeed requires that conversion functions are declared with
nodeclspec-function-declaration.