* typeck.c (decay_conversion): Strip cv-quals from non-class rvalues.
authorJason Merrill <jason@yorick.cygnus.com>
Sat, 2 Oct 1999 01:09:54 +0000 (01:09 +0000)
committerJason Merrill <jason@gcc.gnu.org>
Sat, 2 Oct 1999 01:09:54 +0000 (21:09 -0400)
From-SVN: r29762

gcc/cp/ChangeLog
gcc/cp/typeck.c

index bef91e9..814e211 100644 (file)
@@ -1,3 +1,7 @@
+1999-10-01  Jason Merrill  <jason@yorick.cygnus.com>
+
+       * typeck.c (decay_conversion): Strip cv-quals from non-class rvalues.
+
 1999-10-01  Mark Mitchell  <mark@codesourcery.com>
 
        * pt.c (tsubst_decl): If the type of a template instantiation is
index 4a28de2..5395d7d 100644 (file)
@@ -1789,6 +1789,11 @@ decay_conversion (exp)
       return cp_convert (ptrtype, adr);
     }
 
+  /* [basic.lval]: Class rvalues can have cv-qualified types; non-class
+     rvalues always have cv-unqualified types.  */
+  if (! CLASS_TYPE_P (type))
+    exp = cp_convert (TYPE_MAIN_VARIANT (type), exp);
+
   return exp;
 }