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

--- Comment #6 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to W E Brown from comment #4)
> In brief, I believe Comment 3's example ought compile due to
> [namespace.udecl]/14, but the original example ought not compile due to
> [over.load]/2.3.

But [over.load]/2.3 is not why GCC gives an error. The definition of Derived is
accepted, it's trying to call declval<const Derived&>().method() that is
rejected.

None of GCC, Clang, EDG or MSVC reject the definition of Derived.

(In reply to Daniel from comment #5)
> As a sidenote, the original example is also compiling if test object is made
> non-const, i.e. "const Derived test;" is replaced with "Derived test;"
> 
> If the argument in Comment 1 is true than the program would still be
> ill-formed in this case, wouldn't it?

Yes.

I'm not sure what the relevant rule is here, but I don't think it's
[over.load]/2.3

Reply via email to