diff options
author | Jakub Jelinek <jakub@redhat.com> | 2021-06-04 11:17:05 +0200 |
---|---|---|
committer | Jakub Jelinek <jakub@redhat.com> | 2021-06-04 11:17:05 +0200 |
commit | 3011f1046628d5ce5e6e5f8e917a6aea1385fdc3 (patch) | |
tree | f62be98e3df30a61c8ee59805ae7d3ac003e5e85 /gcc/fortran/openmp.c | |
parent | 39e5a954c156f7af16aa1a8f87405433d8031c4e (diff) | |
download | gcc-3011f1046628d5ce5e6e5f8e917a6aea1385fdc3.zip gcc-3011f1046628d5ce5e6e5f8e917a6aea1385fdc3.tar.gz gcc-3011f1046628d5ce5e6e5f8e917a6aea1385fdc3.tar.bz2 |
c++: Fix up attribute handling in methods in templates [PR100872]
The following testcase FAILs because a dependent (late) attribute is never
tsubsted. While the testcase is OpenMP, I think it is a generic C++ FE problem
that could affect any other dependent attribute.
apply_late_template_attributes documents that it relies on
/* save_template_attributes puts the dependent attributes at the beginning of
the list; find the non-dependent ones. */
The "operator binding" attributes that are sometimes added are added to the
head of DECL_ATTRIBUTES list though and because it doesn't have
ATTR_IS_DEPENDENT set it violates this requirement.
The following patch fixes it by adding that attribute after all
ATTR_IS_DEPENDENT attributes. I'm not 100% sure if DECL_ATTRIBUTES can't be
shared by multiple functions (e.g. the cdtor clones), but the code uses
later remove_attribute which could break that too.
Other option would be to copy_list the ATTR_IS_DEPENDENT portion of the
DECL_ATTRIBUTES list if we need to do this, that would be the same as this
patch but replace that *ap = op_attr; at the end with
*ap = NULL_TREE;
DECL_ATTRIBUTES (cfn) = chainon (copy_list (DECL_ATTRIBUTES (cfn)),
op_attr);
Or perhaps set ATTR_IS_DEPENDENT on the "operator bindings" attribute,
though it would need to be studied what would it try to do with the
attribute during tsubst.
2021-06-04 Jakub Jelinek <jakub@redhat.com>
PR c++/100872
* name-lookup.c (maybe_save_operator_binding): Add op_attr after all
ATTR_IS_DEPENDENT attributes in the DECL_ATTRIBUTES list rather than
to the start.
* g++.dg/gomp/declare-simd-8.C: New test.
Diffstat (limited to 'gcc/fortran/openmp.c')
0 files changed, 0 insertions, 0 deletions