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++/10200] Weird clash with same names in different scopes


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<" :-)

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