This is the mail archive of the gcc@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]

alias template bug?


I just updated to GCC from trunk (r192711) and started getting some
peculiar errors. In particular, GCC seems to believe that sizeof(T) is
no longer a constant when used as an argument to an alias template.
Here's the smallest reproduction I can create with the relevant error:


template<int N>
  struct type { };

template<int N>
  using alias = type<N>;

template <typename T>
  struct use
  {
    alias<sizeof(T)> member; // <-- error: integral expression ‘sizeof
(T)’ is not constant
  };

This happens with arguments including alignof(), and various
__type_traits() also. Replacing the errant declaration with
"type<sizeof(T)>" works fine. It looks like this problem may have been
introduced during a change to instantiate template aliases inside
template definitions, because I wasn't getting this behavior in my
previous version (~1 month old? 2?).

Andrew Sutton
andrew.n.sutton@gmail.com


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