[C++ PATCH] Last canonical type fix for arrays

Doug Gregor doug.gregor@gmail.com
Mon Sep 24 14:59:00 GMT 2007


A recently-provided test case for PR 33185 illustrated one last tiny
problem with the handling of canonical types for typedef'd arrays to
cv-qualified types. This one-liner handles this case appropriately.

Tested i686-pc-linux-gnu, committed as obvious.

  - Doug

2007-09-24  Douglas Gregor  <doug.gregor@gmail.com>

	PR c++/33185	
	* tree.c (cp_build_qualified_type_real): Build a canonical
	ARRAY_TYPE if the original ARRAY_TYPE was not a canonical type.

Index: tree.c
===================================================================
--- tree.c	(revision 128711)
+++ tree.c	(working copy)
@@ -738,7 +738,8 @@ cp_build_qualified_type_real (tree type,
 	    SET_TYPE_STRUCTURAL_EQUALITY (t);
 	  else if (TYPE_CANONICAL (element_type) != element_type
 		   || (index_type
-		       && TYPE_CANONICAL (index_type) != index_type))
+		       && TYPE_CANONICAL (index_type) != index_type)
+		   || TYPE_CANONICAL (type) != type)
 	    TYPE_CANONICAL (t)
 	      = build_cplus_array_type
 	         (TYPE_CANONICAL (element_type),



More information about the Gcc-patches mailing list