• Re: Namespace vs. class ambiguity: three compilers - three different ou

    From Andrey Tarasevich@21:1/5 to Bonita Montero on Mon Sep 9 21:31:11 2024
    On 09/07/24 11:42 AM, Bonita Montero wrote:

    Does it really matter or is it just sufficient to prevent such code ?


    Dark corners like that belong to the same ballpark as, say, that popular "niebloid" trickery everyone appears to be so exited about. When the
    need for such tricks arises, yeah, it might matter.

    --
    Best regards,
    Andrey

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Andrey Tarasevich@21:1/5 to Andrey Tarasevich on Mon Sep 9 21:27:41 2024
    On 09/07/24 11:24 AM, Andrey Tarasevich wrote:

    Clang issues an error: it complains about the call being ambiguous. I.e.
    the error is issued at the point of the call.

    MSVC++ issues an error for `using X::N;` at the point of
    using-declaration: it basically says that `N` already exists in this
    scope. But if we switch to `using namespace X;` version, MSVC++ will
    exhibit Clang-like behavior: complain about ambiguity at the point of
    the call.

    More precisely, it is not the call that's ambiguous. These compilers do
    not even get to the call itself. They complain about the ambiguity of
    `N` and just stop there. Which means that trying to "resolve" this
    ambiguity by renaming one of the functions is not going to make any
    difference.

    GCC also "resolves" at the `N` stage. It just ignores the class entirely.

    --
    Best regards,
    Andrey

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)