OSDN Git Service

2008-10-01 Kai Tietz <kai.tietz@onevision.com>
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / g++.dg / init / struct2.C
1 /* PR c++/23180.  */
2 /* Initialize a local structure with an expression that attempts to use
3    pointer arithmetic to calculate another structure field offset.  */
4
5 void saveLoadEntries(const void *);
6
7 void saveOrLoad() {
8     struct Track {
9         char soundName[15];
10     };
11     struct SaveLoadEntry {
12         int offs;
13         int type;
14         int size;
15     };    
16
17     SaveLoadEntry trackEntries = {
18         ((long) (__SIZE_TYPE__) (&((Track *) 42)->soundName[0])) - 42,
19         0, 1
20     };
21     saveLoadEntries(&trackEntries);
22 }