1 // These classes are technically zero-sized, but despite that they still don't 2 // get an `_address` field inserted. 3 4 /** 5 * Bizarrely enough, this should *not* get an `_address` field. 6 */ 7 class ZeroSizedArray { 8 char arr[0]; 9 }; 10 11 /** 12 * And nor should this get an `_address` field. 13 */ 14 class ContainsZeroSizedArray { 15 ZeroSizedArray zsa; 16 }; 17 18 /** 19 * Inheriting from ZeroSizedArray shouldn't cause an `_address` to be inserted 20 * either. 21 */ 22 class InheritsZeroSizedArray : ZeroSizedArray {}; 23 24 // These are dynamically sized, which means that `sizeof` yields `0` but it 25 // isn't really true. We shouldn't add an `_address` field to them. 26 27 /** 28 * And this should not get an `_address` field either. 29 */ 30 class DynamicallySizedArray { 31 char arr[]; 32 }; 33 34 /** 35 * No `_address` field here either. 36 */ 37 class ContainsDynamicallySizedArray { 38 DynamicallySizedArray dsa; 39 }; 40 41 // Note: this is disallowed: 42 // 43 // error: base class 'DynamicallySizedArray' has a flexible array member 44 // 45 // class InheritsDynamicallySizedArray : DynamicallySizedArray {}; 46