]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR c++/47003 (ice in stabilize_expr)
authorJason Merrill <jason@redhat.com>
Wed, 22 Dec 2010 19:23:15 +0000 (14:23 -0500)
committerJason Merrill <jason@gcc.gnu.org>
Wed, 22 Dec 2010 19:23:15 +0000 (14:23 -0500)
PR c++/47003
* tree.c (stabilize_expr): Really stabilize scalar glvalues.

From-SVN: r168180

gcc/cp/ChangeLog
gcc/cp/tree.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/init/volatile2.C [new file with mode: 0644]

index 62b7d8d8197cbcf6694fb49da5168b59ccc0e653..cb9cd95a272790288b6d1581ddfab1a502565cc9 100644 (file)
@@ -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
index 1a77dc18f328d1fa4e58e9802018f03aac477fc5..ecb764adcc35793512d030dad9c7454737a1aa04 100644 (file)
@@ -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);
index 06257d17853dfb73b5c7eccace025c8fe001ee1a..906fc60ab4e7f2ec46b7d672bc5599a3e15dcd30 100644 (file)
@@ -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 (file)
index 0000000..036d5f1
--- /dev/null
@@ -0,0 +1,13 @@
+// PR c++/47003
+
+struct A
+{
+  A(int);
+};
+
+volatile int i;
+
+int main()
+{
+  A *q = new A (i);
+}