g++ doesn't accept correct code:

namespace N
{
    struct S { };
    void f(const S &) { }
}

void f(const N::S &) { }

int main()
{
    N::S v;
    (f)(v); // no ambiguity: ADL is prevented with (), only ::f is considered
}

--------------------------------------
References:

    1) http://www.josuttis.com/tmplbook/ - "9.2.1 Argument-Dependent Lookup",
page 123.

    2) http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2009/n3000.pdf -
"3.4.2 Argument-dependent name lookup", example on page 46.


-- 
           Summary: The prevention of ADL with the help of parentheses
                    doesn't work
           Product: gcc
           Version: 4.4.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: max at e-soft dot ru


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42687

Reply via email to