On Jul 26, 2010, at 4:15 PM, John Thompson wrote:
> And also this one (bug 7109):
>
> class test
> {
> public:
> test();
> int member;
> };
>
> class testStruct
> {
> public:
> testStruct();
> test t;
> };
>
> int i = __builtin_offsetof (testStruct, t);
>
> >clang -cc1 offsetof1.cpp
> offsetof1.cpp:15:9: warning: offset of on non-POD type 'testStruct'
> int i = __builtin_offsetof (testStruct, t);
> ^ ~
> 1 warning generated.
> ---
> Or is it because neither class is strictly POD?
>
> This still has the warning:
>
> struct test
> {
> public:
> test();
> int member;
> };
>
> struct testStruct
> {
> test t;
> };
>
> int i = __builtin_offsetof (testStruct, t);
>
> But this does not:
>
> struct test
> {
> int member;
> };
>
> struct testStruct
> {
> test t;
> };
>
> int i = __builtin_offsetof (testStruct, t);
Clang appears to be doing the right thing in all cases. offsetof isn't defined
on non-POD types.
- Doug
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits