What is correct syntax for explicit call to conversion operator with deduced return type (auto)

Viewed 287

We encountered a curious inconsistency between language implementations in the question What is operator auto in C++?.

There, conversion operator with deduced return type (auto) is called explicitly. But it appears that compilers don't agree whether it should be called using auto or the deduced type GCC Clang:

struct A
{
  operator auto() { return 0; }
};

int main()
{
   A a;
   a.operator auto(); // Clang and MSVC: OK,    GCC: ERROR
   a.operator int();  // Clang and MSVC: ERROR, GCC: OK
}

Which language implementation is correct? Is this under-specified in the standard?

0 Answers
Related