C++ PATCH for c++/17743, 19163 (attribute align in templates)

Mark Mitchell mark@codesourcery.com
Mon Sep 17 21:49:00 GMT 2007


Benjamin Kosnik wrote:
> Jason! This patch is superfly. Thanks for fixing this.
> 
>> One possible fix for reuse within the same class is to say that
> typedefs with attribute > (aligned) are dependent. Thoughts?
> 
> To me, this seem correct, as:
> 
>    template<typename T>
>      struct X
> {
>         typedef char layout_type[sizeof(T)]
> __attribute__((aligned(__alignof__(T))));
>       };
> 
> X::layout_type is dependent on T's alignof.

Of course, X::layout_type is already dependent, because of the use of T
in the sizeof.  But, I agree; something like:

  typedef char layout_type[16] __attribute__((aligned(__alignof__(T)));

ought to be considered a dependent type.

Thanks,

-- 
Mark Mitchell
CodeSourcery
mark@codesourcery.com
(650) 331-3385 x713



More information about the Gcc-patches mailing list