@@ -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);
new file mode 100644
@@ -0,0 +1,13 @@
+// PR c++/47003
+
+struct A
+{
+ A(int);
+};
+
+volatile int i;
+
+int main()
+{
+ A *q = new A (i);
+}