Consider the following piece of code:

struct S { union { int arr1[10]; char arr2[sizeof(arr1)]; }; };

It compiles successfully with gcc 4.9.2 in c++03 and c++11 mode. However when I change S to be a template like so:

template <size_t N> struct S { union { int arr1[N]; char arr2[sizeof(arr1)]; }; };

I get the following error output:

error: int S<10ul>::<anonymous union>::arr1 [10]’ is inaccessible int arr1[N]; error: within this context char arr2[sizeof(arr1)];