This is the mail archive of the gcc-bugs@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]

[Bug c++/13165] "Koenig lookup" bug


------- 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


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