This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: C++ PATCH for c++/49418 (lost cv-quals on template parameter type)


On 06/23/2011 08:45 PM, H.J. Lu wrote:
This caused:

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49519

I'm checking this in as an alternate fix. Testing hasn't completed yet, but I'm confident that this version is safe.
commit 9084174e504fed2e454948c24144e2a93fabdad2
Author: Jason Merrill <jason@redhat.com>
Date:   Thu Jun 23 22:07:43 2011 -0400

    	PR c++/49418
    	* typeck2.c (build_functional_cast): Strip cv-quals for value init.
    	* init.c (build_zero_init_1): Not here.

diff --git a/gcc/cp/init.c b/gcc/cp/init.c
index 62b68f2..3c347a4 100644
--- a/gcc/cp/init.c
+++ b/gcc/cp/init.c
@@ -176,7 +176,7 @@ build_zero_init_1 (tree type, tree nelts, bool static_storage_p,
        initialized are initialized to zero.  */
     ;
   else if (SCALAR_TYPE_P (type))
-    init = convert (cv_unqualified (type), integer_zero_node);
+    init = convert (type, integer_zero_node);
   else if (CLASS_TYPE_P (type))
     {
       tree field;
diff --git a/gcc/cp/typeck2.c b/gcc/cp/typeck2.c
index ff2949c..8bb938e 100644
--- a/gcc/cp/typeck2.c
+++ b/gcc/cp/typeck2.c
@@ -1641,7 +1641,7 @@ build_functional_cast (tree exp, tree parms, tsubst_flags_t complain)
 	{
 	  if (VOID_TYPE_P (type))
 	    return void_zero_node;
-	  return build_value_init (type, complain);
+	  return build_value_init (cv_unqualified (type), complain);
 	}
 
       /* This must build a C cast.  */

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]