This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: 3.4 Bug? template dependent name lookup fails from template functions


llewelly@xmission.com writes:

| > Am I right, and GCC contains a bug? If so, should I file a bug report
| > with target gcc-3.4.1 ?
| > 
| > 
| >    $ cat t7.cc
| >    void F(int) {}
| >    void F(char) {}
| > 
| >    template <class T> struct A {};
| > 
| >    template <class T>
| >    void F(const A<T> & )
| >    {
| >        T t;
| >        F(t); // ok for T=double

[...]

| However - this can't be the end of it; comeau online reports errors
|     for *both* calls to F, unlike gcc 3.4 which at least accepts the
|     first call.

como is right and GCC is wrong.  The reason is that in the call F(t),
F is dependent, so it is resolved at instantiation time through
argument dependent name lookup.  However, because double is
a builtin type, the set its associated namespaces and classes is
empty.  Therefore, the call fails for "no matching" function.
This is just one of the few cases where we do not do ADL right.
Another case I'm aware of is when we should be ignoring functions
with internal linkage, in the second phase of name lookup.

-- Gaby


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]