@@ -6042,7 +6042,7 @@ cxx_eval_call_expression (const constexp
}
pop_cx_call_context ();
- return result;
+ return unshare_expr (result);
}
/* FIXME speed this up, it's taking 16% of compile time on sieve testcase. */
@@ -0,0 +1,27 @@
+// PR c++/46526
+// { dg-do run }
+// { dg-options "-std=c++0x" }
+
+struct Base
+{
+ virtual int getid () = 0;
+};
+
+struct A : public Base
+{
+ virtual int getid () { return 1; }
+};
+
+struct B : public Base
+{
+ virtual int getid () { throw "here"; }
+};
+
+int
+main ()
+{
+ A a;
+ B b;
+ Base& ar = a;
+ ar.getid ();
+}