[Bug c++/38611] [4.2/4.3/4.4 Regression] alignof is broken for user aligned types in templates
pinskia at gcc dot gnu dot org
gcc-bugzilla@gcc.gnu.org
Mon Dec 29 19:03:00 GMT 2008
------- Comment #2 from pinskia at gcc dot gnu dot org 2008-12-29 19:01 -------
If we swap around the MyStruct and the attribute, it works.
But if we do this:
struct MyStruct1 {
unsigned char skip[272];
} ;
typedef struct MyStruct1 MyStruct __attribute__((aligned(128) ));
template<typename T>
int GetAlignOf()
{
int a[ __alignof__(T) != __alignof__(MyStruct) ? -1 : 1];
return __alignof__(T);
};
int main()
{
int al1 = GetAlignOf<MyStruct>();
int al2 = __alignof__(MyStruct);
return al1 - al2;
}
--- CUT ---
It fails. Meaning we are still losing the user alignment for typedefs.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38611
More information about the Gcc-bugs
mailing list