call.c (standard_conversion): Use RVALUE_CONVs for all expressions that satisfy lvalu...
authorMark Mitchell <mark@codesourcery.com>
Mon, 23 Oct 2000 06:36:37 +0000 (06:36 +0000)
committerMark Mitchell <mmitchel@gcc.gnu.org>
Mon, 23 Oct 2000 06:36:37 +0000 (06:36 +0000)
* call.c (standard_conversion): Use RVALUE_CONVs for all
expressions that satisfy lvalue_p, not just those that satisfy
real_lvalue_p.

From-SVN: r37013

gcc/cp/ChangeLog
gcc/cp/call.c
gcc/testsuite/g++.old-deja/g++.other/dtor11.C [new file with mode: 0644]

index 88f8c8dc75decf2b79b84c4afd162bfdfb3b52c1..635105c732f65418868e1bfe7eaf01d498192693 100644 (file)
@@ -1,5 +1,9 @@
 2000-10-22  Mark Mitchell  <mark@codesourcery.com>
 
+       * call.c (standard_conversion): Use RVALUE_CONVs for all
+       expressions that satisfy lvalue_p, not just those that satisfy
+       real_lvalue_p.
+
        * optimize.c (copy_body_r): Don't treat CALL_EXPRs specially.
 
        * typeck.c (c_sizeof): Return an expression of `size_t' type, 
index af79984a396b028f7c9cdd83f4dd435d0eee7c5a..c31333e96082cece8638b43295e1fda8e731559d 100644 (file)
@@ -685,7 +685,7 @@ standard_conversion (to, from, expr)
       fcode = TREE_CODE (from);
       conv = build_conv (LVALUE_CONV, from, conv);
     }
-  else if (fromref || (expr && real_lvalue_p (expr)))
+  else if (fromref || (expr && lvalue_p (expr)))
     conv = build_conv (RVALUE_CONV, from, conv);
 
    /* Allow conversion between `__complex__' data types  */
diff --git a/gcc/testsuite/g++.old-deja/g++.other/dtor11.C b/gcc/testsuite/g++.old-deja/g++.other/dtor11.C
new file mode 100644 (file)
index 0000000..ffb7c5a
--- /dev/null
@@ -0,0 +1,34 @@
+// Origin: Mark Mitchell <mark@codesourcery.com>
+
+extern "C" void abort ();
+
+int j;
+
+struct S {
+  S () { ++j; }
+  S (const S&) { ++j; }
+  ~S () {
+    if (--j < 0)
+      abort ();
+   }
+};
+
+struct T {
+  void g (S) {
+  };
+};
+
+struct U {
+  int i;
+  S s;
+};
+
+U u;
+
+U f () { return u; }
+
+int main ()
+{
+  T t;
+  t.g (f ().s);
+}