re PR c++/12181 (Wrong code with comma operator and c++)
authorMark Mitchell <mark@codesourcery.com>
Sun, 7 Sep 2003 20:54:11 +0000 (20:54 +0000)
committerMark Mitchell <mmitchel@gcc.gnu.org>
Sun, 7 Sep 2003 20:54:11 +0000 (20:54 +0000)
PR c++/12181
* g++.dg/expr/comma1.C: New test.

From-SVN: r71182

gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/expr/comma1.C [new file with mode: 0644]

index 11de2d92f36f933d67a7ac2ef7430635927293b6..51a01940bdf1b268f34078a6486a62196e6032ab 100644 (file)
@@ -1,3 +1,8 @@
+2003-09-07  Mark Mitchell  <mark@codesourcery.com>
+
+       PR c++/12181
+       * g++.dg/expr/comma1.C: New test.
+
 2003-09-06  Mark Mitchell  <mark@codesourcery.com>
 
        PR c++/11867
diff --git a/gcc/testsuite/g++.dg/expr/comma1.C b/gcc/testsuite/g++.dg/expr/comma1.C
new file mode 100644 (file)
index 0000000..5424ce1
--- /dev/null
@@ -0,0 +1,21 @@
+// { dg-do run }
+
+extern "C" void abort ();
+
+struct gtst
+{
+  unsigned char data[2];
+};
+
+static struct gtst s;
+
+int main(int argc, char *argv[])
+{
+  unsigned char * pc;
+  struct gtst * ps;
+  ps = &s;
+  pc = (ps->data[0]='A', ps->data);
+  if (&s.data[0] != pc)
+    abort();
+  return 0;
+}