diff options
author | Jason Merrill <jason@redhat.com> | 2010-12-22 14:23:15 -0500 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2010-12-22 14:23:15 -0500 |
commit | 7d127f5921df15abb3d4bdbc3f71f4784c641207 (patch) | |
tree | 3addc503e7d9d3b1a41116431328e3849a7a0e44 /gcc | |
parent | 711aef43312b1b8ca3f3ee4f53db27299ae9c2f4 (diff) | |
download | gcc-7d127f5921df15abb3d4bdbc3f71f4784c641207.zip gcc-7d127f5921df15abb3d4bdbc3f71f4784c641207.tar.gz gcc-7d127f5921df15abb3d4bdbc3f71f4784c641207.tar.bz2 |
re PR c++/47003 (ice in stabilize_expr)
PR c++/47003
* tree.c (stabilize_expr): Really stabilize scalar glvalues.
From-SVN: r168180
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/cp/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/cp/tree.c | 4 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/init/volatile2.C | 13 |
4 files changed, 23 insertions, 3 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 62b7d8d..cb9cd95 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2010-12-22 Jason Merrill <jason@redhat.com> + + PR c++/47003 + * tree.c (stabilize_expr): Really stabilize scalar glvalues. + 2010-12-22 Rodrigo Rivas Costa <rodrigorivascosta@gmail.com> * parser.c (cp_parser_unary_expression): Call pedwarn for alignof diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c index 1a77dc1..ecb764a 100644 --- a/gcc/cp/tree.c +++ b/gcc/cp/tree.c @@ -3058,9 +3058,7 @@ stabilize_expr (tree exp, tree* initp) if (!TREE_SIDE_EFFECTS (exp)) init_expr = NULL_TREE; - /* There are no expressions with REFERENCE_TYPE, but there can be call - arguments with such a type; just treat it as a pointer. */ - else if (TREE_CODE (TREE_TYPE (exp)) == REFERENCE_TYPE + else if (!TYPE_NEEDS_CONSTRUCTING (TREE_TYPE (exp)) || !lvalue_or_rvalue_with_address_p (exp)) { init_expr = get_target_expr (exp); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 06257d1..906fc60 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2010-12-22 Jason Merrill <jason@redhat.com> + + * g++.dg/init/volatile2.C: New. + 2010-12-22 Rodrigo Rivas Costa <rodrigorivascosta@gmail.com> * g++.dg/cpp0x/alignof2.C: New. diff --git a/gcc/testsuite/g++.dg/init/volatile2.C b/gcc/testsuite/g++.dg/init/volatile2.C new file mode 100644 index 0000000..036d5f1 --- /dev/null +++ b/gcc/testsuite/g++.dg/init/volatile2.C @@ -0,0 +1,13 @@ +// PR c++/47003 + +struct A +{ + A(int); +}; + +volatile int i; + +int main() +{ + A *q = new A (i); +} |