On 1/14/20 3:29 PM, Nathan Sidwell wrote:
On 1/14/20 3:13 PM, Jason Merrill wrote:
On 1/14/20 2:14 PM, Nathan Sidwell wrote:
+      if (tree ti = (TREE_CODE (fn) == TYPE_DECL && !TYPE_DECL_ALIAS_P (fn)
+             ? TYPE_TEMPLATE_INFO (TREE_TYPE (fn))
+             : DECL_TEMPLATE_INFO (fn)))

Is there a reason not to use get_template_info?

thanks for the pointer, I'll go do that.

Done.

nathan
--
Nathan Sidwell
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index c1375398517..59e0994c397 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,5 +1,9 @@
 2020-01-14  Nathan Sidwell  <nat...@acm.org>
 
+	PT c++/90916
+	* pt.c (retrieve_specialization): Use get_template_info, not open
+	coding access.
+
 	PR c++/90916
 	* pt.c (retrieve_specialization): Get the TI from the decl or the
 	classtype as appropriate.
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index 7e675ce9039..9bb8cc13e5f 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -1252,9 +1252,7 @@ retrieve_specialization (tree tmpl, tree args, hashval_t hash)
       for (ovl_iterator iter (fns); iter; ++iter)
 	{
 	  tree fn = *iter;
-	  if (tree ti = (TREE_CODE (fn) == TYPE_DECL && !TYPE_DECL_ALIAS_P (fn)
-			 ? TYPE_TEMPLATE_INFO (TREE_TYPE (fn))
-			 : DECL_TEMPLATE_INFO (fn)))
+	  if (tree ti = get_template_info (fn))
 	    if (TI_TEMPLATE (ti) == tmpl
 		/* using-declarations can bring in a different
 		   instantiation of tmpl as a member of a different

Reply via email to