public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/18195] New: Two-stage lookup doesn't work correctly with namespaces
@ 2004-10-28 11:06 schepler at math dot berkeley dot edu
2004-10-28 13:53 ` [Bug c++/18195] " pinskia at gcc dot gnu dot org
0 siblings, 1 reply; 2+ messages in thread
From: schepler at math dot berkeley dot edu @ 2004-10-28 11:06 UTC (permalink / raw)
To: gcc-bugs
With the following test program, I get compiler errors with g++-3.4 on both
i386-linux and x86_64-linux (but not with g++-3.3).
namespace A {
class B { };
B* transform(B*);
template <class T> void transform_in_place(T*& p) { p = A::transform(p); }
class C { };
C* transform(C*);
};
namespace A {
class D { };
D* transform(D*);
};
void foo() {
A::B *b;
A::C *c;
A::D *d;
A::transform_in_place(b);
A::transform_in_place(c);
A::transform_in_place(d);
}
The exact error messages are:
ns2.cpp: In function `void A::transform_in_place(T*&) [with T = A::C]':
ns2.cpp:25: instantiated from here
ns2.cpp:6: error: cannot convert `A::C*' to `A::B*' for argument `1' to `A::B*
A::transform(A::B*)'
ns2.cpp: In function `void A::transform_in_place(T*&) [with T = A::D]':
ns2.cpp:26: instantiated from here
ns2.cpp:6: error: cannot convert `A::D*' to `A::B*' for argument `1' to `A::B*
A::transform(A::B*)'
If I remove the namespace A everywhere, then this file compiles without
errors. According to my understanding of the section "Name lookup" under "C++
Misunderstandings" in the info file, this code should be correct since the
call to transform depends on a template parameter, so the lookup should happen
at instantiation time.
(This is a condensed case of problems I'm getting with various versions of
gtk--, after correcting other things.)
g++ -v shows:
Reading specs from /usr/lib/gcc/x86_64-linux/3.4.2/specs
Configured with: ../src/configure -v
--enable-languages=c,c++,java,f77,pascal,objc,treelang --prefix=/usr
--libexecdir=/usr/lib --with-gxx-include-dir=/usr/include/c++/3.4
--enable-shared --with-system-zlib --enable-nls --without-included-gettext
--program-suffix=-3.4 --enable-__cxa_atexit --enable-libstdcxx-allocator=mt
--enable-clocale=gnu --enable-libstdcxx-debug --enable-java-gc=boehm
--enable-java-awt=gtk --disable-werror x86_64-linux
Thread model: posix
gcc version 3.4.2 (Debian 3.4.2-3)
--
Summary: Two-stage lookup doesn't work correctly with namespaces
Product: gcc
Version: 3.4.2
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: schepler at math dot berkeley dot edu
CC: gcc-bugs at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18195
^ permalink raw reply [flat|nested] 2+ messages in thread
* [Bug c++/18195] Two-stage lookup doesn't work correctly with namespaces
2004-10-28 11:06 [Bug c++/18195] New: Two-stage lookup doesn't work correctly with namespaces schepler at math dot berkeley dot edu
@ 2004-10-28 13:53 ` pinskia at gcc dot gnu dot org
0 siblings, 0 replies; 2+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-10-28 13:53 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2004-10-28 13:53 -------
This is invalid.
>From [temp.dep.candidate]:
For a function call that depends on a template parameter, if the function name is an "unqualified-id"
but not a template-id, the candidate functions are found using the usual lookup rules (3.4.1, 3.4.2)
except that:
*** This bug has been marked as a duplicate of 11828 ***
--
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |DUPLICATE
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18195
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2004-10-28 13:53 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-10-28 11:06 [Bug c++/18195] New: Two-stage lookup doesn't work correctly with namespaces schepler at math dot berkeley dot edu
2004-10-28 13:53 ` [Bug c++/18195] " pinskia at gcc dot gnu dot org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).