This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/19092] g++ accepts code that violates 14.6.4.2
- From: "bangerth at dealii dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 20 Dec 2004 21:30:48 -0000
- Subject: [Bug c++/19092] g++ accepts code that violates 14.6.4.2
- References: <20041220183129.19092.bagnara@cs.unipr.it>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From bangerth at dealii dot org 2004-12-20 21:30 -------
Actually, we can make this a rejects-valid like so:
----------------------
namespace NS1 {
struct X {};
void foo(X);
}
namespace NS2 {
static void foo(NS1::X);
template <typename T>
void bar() {
foo(T());
}
}
template void NS2::bar<NS1::X> ();
-----------------------
Since NS2::foo is static, it isn't an eligible overload, so NS1::foo
should be called. However, gcc doesn't realize this:
g/x> c++ x.cc ; ./a.out ; echo $?
x.cc: In function `void NS2::bar() [with T = NS1::X]':
x.cc:15: instantiated from here
x.cc:11: error: call of overloaded `foo(NS1::X)' is ambiguous
x.cc:7: error: candidates are: void NS2::foo(NS1::X)
x.cc:3: error: void NS1::foo(NS1::X)
This fails with all versions of gcc I have.
W.
--
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |rejects-valid
Known to fail| |2.95.3 3.2.3 3.3.1 3.3.4
| |3.4.3 4.0.0
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19092