[PATCH] Fix PR c++/69283 (auto deduction fails when ADL is required)
Jason Merrill
jason@redhat.com
Tue Jan 19 14:56:00 GMT 2016
On 01/18/2016 10:55 PM, Patrick Palka wrote:
> mark_used is wrongly diagnosing a use of a TEMPLATE_DECL (e.g. the call
> to f1 in function f3 of auto-fn29.C below) for having an undeduced
> 'auto' return type. This doesn't make sense, because an 'auto' used
> inside a template doesn't get deduced until after the template is
> instantiated. So for a TEMPLATE_DECL we shouldn't diagnose a use of
> undeduced 'auto' here. After instantiation, presumably we will call
> mark_used on the resulting FUNCTION_DECL which will check for undeduced
> auto appropriately.
> @@ -5112,7 +5112,9 @@ mark_used (tree decl, tsubst_flags_t complain)
> || DECL_LANG_SPECIFIC (decl) == NULL
> || DECL_THUNK_P (decl))
> {
> - if (!processing_template_decl && type_uses_auto (TREE_TYPE (decl)))
> + if (!processing_template_decl
> + && TREE_CODE (decl) != TEMPLATE_DECL
> + && type_uses_auto (TREE_TYPE (decl)))
How does a TEMPLATE_DECL get in here? Does it have null DECL_LANG_SPECIFIC?
I'd think mark_used of a TEMPLATE_DECL should return after setting
TREE_USED, there's nothing else to do with it.
Jason
More information about the Gcc-patches
mailing list