This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/13165] "Koenig lookup" bug
- From: "bangerth at dealii dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 24 Nov 2003 15:05:54 -0000
- Subject: [Bug c++/13165] "Koenig lookup" bug
- References: <20031123101308.13165.paolo@gcc.gnu.org>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From bangerth at dealii dot org 2003-11-24 15:05 -------
Indeed, something's pretty wacky here:
------------------------
template <typename> struct S {
struct iterator {
int operator+(int) const;
};
int foo() { return iterator() + 1U; }
};
namespace N {
struct X {};
template<class T> X operator+(T, unsigned);
}
int main() {
S<N::X> v;
v.foo();
}
----------------------
Inside S::foo, we try to call N::operator+ instead of the one
of the iterator class (and we try to do so because the second
argument is an unsigned, whereas the one in the iterator class
takes a signed integer). I fail to see why we should even try
to look up the operator in namespace N, since none of the
two arguments is in namespace N. Only the (unused) template
argument of S is in that namespace.
I am not quite sure this actually has to do anything with Koenig
lookup, since we have the same bug in 3.3.2 and back all the way
to 2.95, when Koenig lookup wasn't implemented. Odd...
W.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever Confirmed| |1
Last reconfirmed|0000-00-00 00:00:00 |2003-11-24 15:05:54
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13165