re PR c++/8748 (ICE in cp_expr_size at cp/cp-lang.c: 307)
authorJason Merrill <jason@gcc.gnu.org>
Mon, 13 Jan 2003 09:16:21 +0000 (04:16 -0500)
committerJason Merrill <jason@gcc.gnu.org>
Mon, 13 Jan 2003 09:16:21 +0000 (04:16 -0500)
        PR c++/8748
        * class.c (build_base_path): Take the address before calling save_expr.

From-SVN: r61250

gcc/testsuite/g++.dg/init/save1.C [new file with mode: 0644]

diff --git a/gcc/testsuite/g++.dg/init/save1.C b/gcc/testsuite/g++.dg/init/save1.C
new file mode 100644 (file)
index 0000000..2358eb5
--- /dev/null
@@ -0,0 +1,20 @@
+// PR c++/8748
+// We were wrapping the ARRAY_REF in a SAVE_EXPR, causing us to try to make a bitwise
+// copy of b[0].
+
+struct A
+{
+    int i;
+};
+
+struct B : A
+{
+    virtual ~B();
+};
+
+struct C
+{
+    B b[1];
+};
+
+void foo() { C().b[0].i; }