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++/63506] GCC deduces wrong return type of operator*() inside template functions


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63506

--- Comment #5 from Steffen MÃthing <steffen.muething at iwr dot uni-heidelberg.de> ---
The exact same problem is present on operator[] :

//-------------------------------
struct proxy {};

struct iterator
{
  proxy operator*() { return proxy(); }

  proxy operator[](int i) { return proxy(); }
};

//#define DEACTIVATE

#ifndef DEACTIVATE
template<typename T = int>
#endif
void foo(iterator it)
{
  auto&& x = *it;
  auto&& y = it[1];
}

int main()
{
  iterator it;
  foo(it);
}
//-------------------------------

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