diff mbox

C++ PATCH for typedef stripping with variable templates

Message ID 555A2A9C.3090004@redhat.com
State New
Headers show

Commit Message

Jason Merrill May 18, 2015, 6:08 p.m. UTC
At the Lenexa C++ meeting Walter pointed me at a variable template 
testcase that was breaking, which turned out to be because we were 
failing to strip aliases consistently in variable template arguments, 
leading to mismatches between, in the first testcase, V<float> and V<fl>.

Tested x86_64-pc-linux-gnu, applying to trunk and concepts branch.
diff mbox

Patch

commit c1e703a6f795ea63609098607b4484e4b516af41
Author: Jason Merrill <jason@redhat.com>
Date:   Wed May 13 15:57:00 2015 -0400

    	* pt.c (retrieve_specialization): Make sure our arguments have
    	gone through strip_typedefs.

diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index 2166f5f..60f3958 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -1058,6 +1058,14 @@  retrieve_specialization (tree tmpl, tree args, hashval_t hash)
 		  ? TMPL_PARMS_DEPTH (DECL_TEMPLATE_PARMS (tmpl))
 		  : template_class_depth (DECL_CONTEXT (tmpl))));
 
+#ifdef ENABLE_CHECKING
+  /* We should have gone through coerce_template_parms by now.  */
+  ++processing_template_decl;
+  if (!any_dependent_template_arguments_p (args))
+    gcc_assert (strip_typedefs_expr (args, NULL) == args);
+  --processing_template_decl;
+#endif
+
   if (optimize_specialization_lookup_p (tmpl))
     {
       tree class_template;