This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/63506] GCC deduces wrong return type of operator*() inside template functions
- From: "steffen.muething at iwr dot uni-heidelberg.de" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Mon, 13 Oct 2014 10:01:52 +0000
- Subject: [Bug c++/63506] GCC deduces wrong return type of operator*() inside template functions
- Auto-submitted: auto-generated
- References: <bug-63506-4 at http dot gcc dot gnu dot org/bugzilla/>
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);
}
//-------------------------------