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] New: "Koenig lookup" bug


Hi,

I'm not a language lawyer, but I understand from a presentation by Herb Sutter
that the following snippet should compile (indeed it does with EDG-based
front ends) (nb: same problem with the additional inheritance from _Ranit)

namespace std {
  // template<class T> struct _Ranit {};
  
  template<class T> class vector {
  public:
    class iterator /*: public _Ranit<T> */ {
    public:
      iterator operator+(int) const { return iterator(); }
    };
    iterator operator[](unsigned _Pos) { return iterator() + _Pos; }
  };
}

namespace N {
  struct X {};

  template<class T>
  int* operator+(T, unsigned)
  {static int i; return &i; }
}

int main()
{
  std::vector<N::X> v;
  v[0] = v[1] + 1;
}

-- 
           Summary: "Koenig lookup" bug
           Product: gcc
           Version: 3.4
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: paolo at gcc dot gnu dot org
                CC: gcc-bugs at gcc dot gnu dot org
  GCC host triplet: Any


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]