+2020-05-06 Nathan Sidwell <nathan@acm.org>
+
+ PR c++/94946
+ * decl.c (grokdeclarator): Don't splice template attributes in
+ parm context -- they can apply to the parm.
+
2020-05-05 Iain Sandoe <iain@sandoe.co.uk>
* coroutines.cc: Remove references to n4849 throughout.
attr_flags |= (int) ATTR_FLAG_FUNCTION_NEXT;
if (declarator->kind == cdk_array)
attr_flags |= (int) ATTR_FLAG_ARRAY_NEXT;
- /* Assume that any attributes that get applied late to templates will
- DTRT when applied to the declaration as a whole. */
- tree late_attrs = splice_template_attributes (&attrs, type);
+ tree late_attrs = NULL_TREE;
+ if (decl_context != PARM)
+ /* Assume that any attributes that get applied late to
+ templates will DTRT when applied to the declaration
+ as a whole. */
+ late_attrs = splice_template_attributes (&attrs, type);
returned_attrs = decl_attributes (&type,
chainon (returned_attrs, attrs),
attr_flags);
--- /dev/null
+// { dg-do compile { target { { i?86-*-* x86_64-*-* } && ia32 } } }
+// PR 94946
+class a {
+ template <typename b> a(b (*)());
+ template <typename b> a(b(__attribute__((fastcall)) *c)());
+};