* g++.dg/init/struct2.C: New test.
* g++.dg/init/struct3.C: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@104254
138bc75d-0d04-0410-961f-
82ee72b054a4
+2005-09-13 Josh Conner <jconner@apple.com>
+
+ PR c++/23180
+ * g++.dg/init/struct2.C: New test.
+ * g++.dg/init/struct3.C: New test.
+
2005-09-13 Janis Johnson <janis187@us.ibm.com>
* gcc.dg/pr15784-4.c, gcc.dg/pr20130-1.c, gcc.dg/ucnid-6.c:
--- /dev/null
+/* PR c++/23180. */
+/* Initialize a local structure with an expression that attempts to use
+ pointer arithmetic to calculate another structure field offset. */
+
+void saveLoadEntries(const void *);
+
+void saveOrLoad() {
+ struct Track {
+ char soundName[15];
+ };
+ struct SaveLoadEntry {
+ int offs;
+ int type;
+ int size;
+ };
+
+ SaveLoadEntry trackEntries = {
+ ((long) (&((Track *) 42)->soundName[0])) - 42,
+ 0, 1
+ };
+ saveLoadEntries(&trackEntries);
+}
--- /dev/null
+/* 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) (& ((Track *) 42)->soundName[0])) - 42;