c++: QT overload regression with attribute [PR94946]
Jason's fix for 90570 & 79585 was a bit overzealous. Dependent attribs should still attach to a parameter decl. * decl.c (grokdeclarator): Don't splice template attributes in parm context -- they can apply to the parm.
This commit is contained in:
parent
80644a672e
commit
bc95e478fe
3 changed files with 18 additions and 3 deletions
|
@ -1,3 +1,9 @@
|
|||
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.
|
||||
|
|
|
@ -11940,9 +11940,12 @@ grokdeclarator (const cp_declarator *declarator,
|
|||
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);
|
||||
|
|
6
gcc/testsuite/g++.dg/ext/attr-parm-1.C
Normal file
6
gcc/testsuite/g++.dg/ext/attr-parm-1.C
Normal file
|
@ -0,0 +1,6 @@
|
|||
// { 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)());
|
||||
};
|
Loading…
Add table
Reference in a new issue