From 908e152c84b2f3f97f0b5d316e9402aeeeef2b76 Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Thu, 23 Jun 2011 22:18:42 -0400 Subject: [PATCH] re PR c++/49418 (G++ discards cv-quals from template parameter types) PR c++/49418 * typeck2.c (build_functional_cast): Strip cv-quals for value init. * init.c (build_zero_init_1): Not here. From-SVN: r175368 --- gcc/cp/ChangeLog | 4 ++++ gcc/cp/init.c | 2 +- gcc/cp/typeck2.c | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index e00b4001c49..12b12e577da 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,9 @@ 2011-06-23 Jason Merrill + PR c++/49519 + * typeck2.c (build_functional_cast): Strip cv-quals for value init. + * init.c (build_zero_init_1): Not here. + PR c++/35255 * pt.c (resolve_overloaded_unification): Fix DR 115 handling. diff --git a/gcc/cp/init.c b/gcc/cp/init.c index 62b68f2b9ea..3c347a4521f 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 ff2949c510d..8bb938e46a8 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. */ -- 2.30.2