diff mbox

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

Message ID BANLkTinrbz2vMHOXUecMQ6JCF0Zun8PpkQ@mail.gmail.com
State New
Headers show

Commit Message

H.J. Lu June 24, 2011, 3:07 a.m. UTC
On Thu, Jun 23, 2011 at 7:18 PM, Jason Merrill <jason@redhat.com> wrote:
> 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.
>

I still got the same failure with revision 175368.  The problem is caused by
the "While looking at this, I've also changed a few more TYPE_MAIN_VARIANTs
to cv_unqualified" change in

http://gcc.gnu.org/ml/gcc-patches/2011-06/msg01622.html

commit b84cd9b997b527960d42d0855ff281af1550b627
Author: Jason Merrill <jason@redhat.com>
Date:   Tue Jun 21 13:22:34 2011 -0400

    	* call.c (add_builtin_candidates): Use cv_unqualified rather than
    	TYPE_MAIN_VARIANT.
    	* pt.c (tsubst_arg_types): Likewise.
    	* except.c (build_throw): Use cv_unqualified.
diff mbox

Patch

diff --git a/gcc/cp/call.c b/gcc/cp/call.c
index 3ac7a8e..8123e3d 100644
--- a/gcc/cp/call.c
+++ b/gcc/cp/call.c
@@ -2773,7 +2773,7 @@  add_builtin_candidates (struct z_candidate
**candidates, enum tree_code code,
 	      type = non_reference (type);
 	      if (i != 0 || ! ref1)
 		{
-		  type = TYPE_MAIN_VARIANT (type_decays_to (type));
+		  type = cv_unqualified (type_decays_to (type));
 		  if (enum_p && TREE_CODE (type) == ENUMERAL_TYPE)
 		    VEC_safe_push (tree, gc, types[i], type);
 		  if (INTEGRAL_OR_UNSCOPED_ENUMERATION_TYPE_P (type))
@@ -2792,7 +2792,7 @@  add_builtin_candidates (struct z_candidate
**candidates, enum tree_code code,
 	  type = non_reference (argtypes[i]);
 	  if (i != 0 || ! ref1)
 	    {
-	      type = TYPE_MAIN_VARIANT (type_decays_to (type));
+	      type = cv_unqualified (type_decays_to (type));
 	      if (enum_p && UNSCOPED_ENUM_P (type))
 		VEC_safe_push (tree, gc, types[i], type);
 	      if (INTEGRAL_OR_UNSCOPED_ENUMERATION_TYPE_P (type))
diff --git a/gcc/cp/except.c b/gcc/cp/except.c
index 3399652..f8c8e47 100644
--- a/gcc/cp/except.c
+++ b/gcc/cp/except.c
@@ -722,7 +722,7 @@  build_throw (tree exp)
 	 respectively.  */
       temp_type = is_bitfield_expr_with_lowered_type (exp);
       if (!temp_type)
-	temp_type = type_decays_to (TREE_TYPE (exp));
+	temp_type = cv_unqualified (type_decays_to (TREE_TYPE (exp)));

       /* OK, this is kind of wacky.  The standard says that we call
 	 terminate when the exception handling mechanism, after
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index 4d2caa8..2716f78 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -10246,7 +10246,7 @@  tsubst_arg_types (tree arg_types,

     /* Do array-to-pointer, function-to-pointer conversion, and ignore
        top-level qualifiers as required.  */
-    type = TYPE_MAIN_VARIANT (type_decays_to (type));
+    type = cv_unqualified (type_decays_to (type));

     /* We do not substitute into default arguments here.  The standard
        mandates that they be instantiated only when needed, which is