Skip to content
Snippets Groups Projects
user avatar
Jakub Jelinek authored
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.
801fb71f
History
Name Last commit Last update