[Bug c++/19092] g++ accepts code that violates 14.6.4.2
bangerth at dealii dot org
gcc-bugzilla@gcc.gnu.org
Mon Dec 20 21:30:00 GMT 2004
------- 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
More information about the Gcc-bugs
mailing list