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|2016-01-22 00:00:00         |2016-2-8

--- Comment #32 from Jonathan Wakely <redi at gcc dot gnu.org> ---
The new testcase gets two errors (both due to treating "q->exp< N" as the start
of a template) and Manu's suggestion in comment 30 only helps with the second
one.

Slightly further reduced (the macro shows how in gcc-5 this bug was only
encountered by using <cmath> and using std::exp, but in gcc 6 it's also
encountered with <math.h> because that now has the using declaration):

namespace std {
  template<typename T> T exp(T t) { return t; }
}
#ifndef NO_USING
using std::exp;
#endif

template <typename> class A {
  struct B { long exp; };
  void m_fn1();
};

template <typename Key> void A<Key>::m_fn1() {
  long insert_exp = 1;
  B q;
  (q->exp < insert_exp);
}

exp.cc: In member function âvoid A< <template-parameter-1-1> >::m_fn1()â:
exp.cc:16:13: error: the value of âinsert_expâ is not usable in a constant
expression
   (q->exp < insert_exp);
             ^
exp.cc:14:8: note: âlong int insert_expâ is not const
   long insert_exp = 1;
        ^
exp.cc:16:7: error: parse error in template argument list
   (q->exp < insert_exp);
       ^

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