diff options
author | Jakub Jelinek <jakub@redhat.com> | 2025-02-07 14:28:57 +0100 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2025-02-07 14:28:57 +0100 |
commit | 801fb71f83624f0bf6d6bd27121d4a332103f7be (patch) | |
tree | 3c1f57271e806e2d2e0d752177ee15c276a232f1 /gcc/testsuite/g++.dg/cpp0x | |
parent | 6c8e6d6febaed3c167ca9534935c2cb18045528e (diff) | |
download | gcc-801fb71f83624f0bf6d6bd27121d4a332103f7be.zip gcc-801fb71f83624f0bf6d6bd27121d4a332103f7be.tar.gz gcc-801fb71f83624f0bf6d6bd27121d4a332103f7be.tar.bz2 |
c++: Use cplus_decl_attributes rather than decl_attributes in grokdecl [PR118773]
My r15-3046 change regressed the first half of the following testcase.
When it calls decl_attributes, it doesn't handle attributes with
dependent arguments correctly and so is now rejected that N is not
a constant integer during template parsing.
I've actually followed the pointer/reference case which did that
too and that one has been failing for a couple of years on the
second part of the testcase.
Note, there is also
if (decl_context != PARM && decl_context != TYPENAME)
/* 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,
attr_chainon (returned_attrs,
attrs),
attr_flags);
returned_attrs = attr_chainon (late_attrs, returned_attrs);
call directly to decl_attributes in grokdeclarator, but this one handles
the splicing manually, so maybe it is ok as is (and I don't have a testcase
of anything misbehaving for that).
2025-02-07 Jakub Jelinek <jakub@redhat.com>
PR c++/118773
* decl.cc (grokdeclarator): Use cplus_decl_attributes rather than
decl_attributes for std_attributes on pointer and array types.
* g++.dg/cpp0x/gen-attrs-87.C: New test.
* g++.dg/gomp/attrs-3.C: Adjust expected diagnostics.
Diffstat (limited to 'gcc/testsuite/g++.dg/cpp0x')
-rw-r--r-- | gcc/testsuite/g++.dg/cpp0x/gen-attrs-87.C | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.dg/cpp0x/gen-attrs-87.C b/gcc/testsuite/g++.dg/cpp0x/gen-attrs-87.C new file mode 100644 index 0000000..465e809 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/gen-attrs-87.C @@ -0,0 +1,10 @@ +// PR c++/118773 +// { dg-do compile { target c++11 } } +// { dg-options "" } + +template <unsigned N> +using T = char[4] [[gnu::aligned (N)]]; +T<2> t; +template <unsigned N> +using U = char *[[gnu::aligned (N)]]*; +U<__alignof (char *)> u; |