Martin Sebor wrote: > >Travis Vitek wrote: >> >> Here is a testcase... >> >> $ cat z.cpp && g++ --version && g++ -c z.cpp >> >> template <int N, int A> >> struct __rw_aligned_storage { >> typedef struct { >> char _C_align [N] __attribute__ ((aligned (A))); >> } type; >> }; >> >> __rw_aligned_storage<10, 4>::type aligned_t; >>
[...] >> >> z.cpp: In instantiation of '__rw_aligned_storage<10, 4>::type': >> z.cpp:9: instantiated from here >> z.cpp:5: error: requested alignment is not a constant >> >> If I can't access the member type 'type', then the feature >> is useless. The nested type is the only thing that is aligned. >> If you are sure that this will work with gcc-4.3, please show >> me where I've gone wrong. > >Isn't it obvious? You're missing a set of parentheses around A ;-) >This works for me: > > template <int N, int A> > struct __rw_aligned_storage { > typedef struct { > char _C_align [N] __attribute__ ((aligned ((A)))); > } type; > }; > > __rw_aligned_storage<10, 4>::type aligned_t; > >> >> Travis >> Darn you Martin Sebor! Well now that I have a workaround, I can do it the easy way (on one compiler). Travis