This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/10200] Weird clash with same names in different scopes
- From: "redi at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Fri, 22 Jan 2016 18:28:51 +0000
- Subject: [Bug c++/10200] Weird clash with same names in different scopes
- Auto-submitted: auto-generated
- References: <bug-10200-4 at http dot gcc dot gnu dot org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=10200
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Last reconfirmed|2006-10-21 21:32:49 |2016-1-22
--- Comment #29 from Jonathan Wakely <redi at gcc dot gnu.org> ---
You can trick G++ into finishing the parse incorrectly:
template<bool> inline void end(int) { }
struct S { int end; };
template <typename T>
bool both_negative(const T& t, int u) { return t.end < 0 && 0 > (u); }
int main()
{
return both_negative( S{-1}, -2 );
}
pe.cc: In instantiation of âbool both_negative(const T&, int) [with T = S]â:
pe.cc:10:35: required from here
pe.cc:6:50: error: âendâ is not a member template function
bool both_negative(const T& t, int u) { return t.end < 0 && 0 > (u); }
~~^~~~~~~~~~~~~~
I know it isn't, that's why I didn't write "t.template end<" :-)