https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101904

--- Comment #4 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Jonathan Wakely from comment #3)
> I think Clang doesn't even bother to instantiate the return type for the
> non-const overload, because it wouldn't be viable. I'm not sure if that's a
> conforming implementation or not.

[temp.inst] p9:

"If the function selected by overload resolution (12.2) can be determined
without instantiating a class template definition, it is unspecified whether
that instantiation actually takes place."

So the compiler is permitted to skip the result_of instantiation in the return
type if it knows that overload won't be selected anyway. But it's not required
to skip it, so your code is still wrong.

Reply via email to