[Bug c++/11828] [3.4/4.0 regression] qualified dependent name looked up too early

smcpeak at cs dot berkeley dot edu gcc-bugzilla@gcc.gnu.org
Fri Mar 4 05:00:00 GMT 2005

------- Additional Comments From smcpeak at cs dot berkeley dot edu  2005-03-04 05:00 -------
I think I have answered my own question: indeed, qualified lookup
only considers name from the definition context, and not the
instantiation context.

I found this thread at google groups:


Quoting from a few of the more useful messages:


    Moving to templates. Point of definition does both normal and argument
    dependent lookup, point of instantiation does ADL only (14.6.4/1.)

    When you disable ADL by writing N::foo(x), the only lookup that
    remains is normal lookup done at point of definition. Point of
    instantiation lookup is implicitly disabled as a consequence of the
    interaction between 3.4.2/1 and 14.6.4/1.


    The OL
    part happens at the point of definition (phase 1), and  the ADL
    part happens at the POI (point of instantiation; phase 2).  If
    you remove the ADL part, you're left with a phase 1 lookup only.


    The compromise that was reached was to say that lexical lookup
    would occur only in the definition context; only ADL would be
    performed in the instantiation context.  Since qualified
    function names do not participate in ADL, any arguments in a
    call to a qualified name are ignored in determining whether a
    qualified name is dependent or not.

The upshot is that, by 14.6.4p1, second-phase lookup *only* does
argument-dependent lookup, which is itself disabled by qualification.

This has some nasty consequences, e.g.


but appears to be the genuine intent of the committee.



More information about the Gcc-bugs mailing list