[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:

 
http://groups-beta.google.com/group/comp.std.c++/browse_thread/thread/22521f9b57b995d0/73d79aadca8c665c

Quoting from a few of the more useful messages:

  http://groups-beta.google.com/group/comp.std.c++/msg/ae689cfc9c99262d

    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.

  http://groups-beta.google.com/group/comp.std.c++/msg/0e252a95da0f453d

    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.

  http://groups-beta.google.com/group/comp.std.c++/msg/6a53b35efe39fee3

    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.

  http://groups-beta.google.com/group/comp.std.c++/msg/8379998d36b27a99

but appears to be the genuine intent of the committee.


-- 


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



More information about the Gcc-bugs mailing list