[C++ PATCH] [PR87770] test partial specializations for type dependence
Alexandre Oliva
aoliva@redhat.com
Thu Jan 24 04:28:00 GMT 2019
On Jan 21, 2019, Jason Merrill <jason@redhat.com> wrote:
> "does this have its own template arguments, not just the ones from its
> enclosing class?"
> Perhaps compare the number of levels of template arguments of the
> function to that of its enclosing context?
Is this the logic you had in mind? Or can we assume DECL_P to always be
false at that point, because if the context has template info it must be
a class? (I'm not sure about the context of generic lambdas)
Any suggestion of a good name for the inline function (or would you
prefer it to be a macro?) that tests whether a decl satisfies this
predicate? primary_or_partial_spec_p?
Thanks,
@@ -25622,7 +25622,17 @@ type_dependent_expression_p (tree expression)
that come from the template-id; the template arguments for the
enclosing class do not make it type-dependent unless they are used in
the type of the decl. */
- if (PRIMARY_TEMPLATE_P (DECL_TI_TEMPLATE (expression))
+ if ((PRIMARY_TEMPLATE_P (DECL_TI_TEMPLATE (expression))
+ || (DECL_TEMPLATE_SPECIALIZATION (DECL_TI_TEMPLATE (expression))
+ && (DECL_P (DECL_CONTEXT (expression))
+ ? (!DECL_TI_TEMPLATE (DECL_CONTEXT (expression))
+ || (TMPL_ARGS_DEPTH (DECL_TI_ARGS (expression))
+ > TMPL_ARGS_DEPTH (DECL_TI_ARGS
+ (DECL_CONTEXT (expression)))))
+ : (!CLASSTYPE_TI_TEMPLATE (DECL_CONTEXT (expression))
+ || (TMPL_ARGS_DEPTH (DECL_TI_ARGS (expression))
+ > TMPL_ARGS_DEPTH (CLASSTYPE_TI_ARGS
+ (DECL_CONTEXT (expression))))))))
&& (any_dependent_template_arguments_p
(INNERMOST_TEMPLATE_ARGS (DECL_TI_ARGS (expression)))))
return true;
--
Alexandre Oliva, freedom fighter https://FSFLA.org/blogs/lxo
Be the change, be Free! FSF Latin America board member
GNU Toolchain Engineer Free Software Evangelist
Hay que enGNUrecerse, pero sin perder la terGNUra jamás-GNUChe
More information about the Gcc-patches
mailing list