re PR c++/46526 (VTable Problem?)

PR c++/46526
	* semantics.c (cxx_eval_call_expression): Unshare the result.

	* g++.dg/cpp0x/constexpr-base3.C: New test.

From-SVN: r166967
This commit is contained in:
Jakub Jelinek 2010-11-20 00:50:21 +01:00 committed by Jakub Jelinek
parent 8e97bc2bdb
commit e26ab5ecd2
4 changed files with 36 additions and 1 deletions

View File

@ -1,3 +1,8 @@
2010-11-20 Jakub Jelinek <jakub@redhat.com>
PR c++/46526
* semantics.c (cxx_eval_call_expression): Unshare the result.
2010-11-19 Nicola Pero <nicola.pero@meta-innovation.com>
* parser.c (cp_parser_objc_protocol_declaration): Pass attributes

View File

@ -6042,7 +6042,7 @@ cxx_eval_call_expression (const constexpr_call *old_call, tree t,
}
pop_cx_call_context ();
return result;
return unshare_expr (result);
}
/* FIXME speed this up, it's taking 16% of compile time on sieve testcase. */

View File

@ -1,5 +1,8 @@
2010-11-20 Jakub Jelinek <jakub@redhat.com>
PR c++/46526
* g++.dg/cpp0x/constexpr-base3.C: New test.
PR tree-optimization/45830
* gcc.target/i386/pr45830.c: New test.
* gcc.c-torture/execute/pr45830.c: New test.

View File

@ -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 ();
}