This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
alias template bug?
- From: Andrew Sutton <asutton dot list at gmail dot com>
- To: gcc at gcc dot gnu dot org
- Date: Tue, 23 Oct 2012 14:35:26 -0500
- Subject: 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