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

--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Given:
class C {
  static const long b = 0;
  static const unsigned c = (b);
};
class D {
  static const long b = 0;
  static const unsigned c = b;
};
template <class> class A {
  static const long b = 0;
  static const unsigned c = (b);
};
template <class> class B {
  static const long b = 0;
  static const unsigned c = b;
};

we only reject the A case.
For D and B there is just INTEGER_CST, and for C and A we have:
(unsigned int) (long int) *(const long int &) &b
because of the parens.
The reason why it is accepted outside of template and not inside of it is that
cxx_constant_init calls is_nondependent_static_init_expression which calls
instantiation_dependent_expression_p and that is true in A::c.

Reply via email to