diff options
Diffstat (limited to 'gcc/testsuite/g++.dg/init/struct3.C')
-rw-r--r-- | gcc/testsuite/g++.dg/init/struct3.C | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.dg/init/struct3.C b/gcc/testsuite/g++.dg/init/struct3.C new file mode 100644 index 000000000..53804b3d1 --- /dev/null +++ b/gcc/testsuite/g++.dg/init/struct3.C @@ -0,0 +1,15 @@ +/* PR c++/23180. */ +/* Initialize a global variable with an expression that attempts to use + pointer arithmetic to calculate a structure field offset. */ + +struct Track { + char soundName[15]; +}; + +struct SaveLoadEntry { + int offs; + int type; + int size; +}; + +int foobar = ((long) (__SIZE_TYPE__) (& ((Track *) 42)->soundName[0])) - 42; |