diff options
author | Michael Matz <matz@suse.de> | 2010-03-19 16:37:27 +0000 |
---|---|---|
committer | Michael Matz <matz@gcc.gnu.org> | 2010-03-19 16:37:27 +0000 |
commit | f9ceed32dc9196ddcd2551526637369910a8407b (patch) | |
tree | a2dcdc35ffed6fba09f04d6569bb5b40c33fbe1e /gcc/attribs.c | |
parent | 3795eae6647e2bcac4b998b194150cafee27906f (diff) | |
download | gcc-f9ceed32dc9196ddcd2551526637369910a8407b.zip gcc-f9ceed32dc9196ddcd2551526637369910a8407b.tar.gz gcc-f9ceed32dc9196ddcd2551526637369910a8407b.tar.bz2 |
re PR c++/43116 (ICE when using attributes in a function alias declaration)
PR c++/43116
* attribs.c (decl_attributes): When rebuilding a function pointer
type use the same qualifiers as the original pointer type.
testsuite/
* g++.dg/other/pr43116.C: New testcase.
From-SVN: r157578
Diffstat (limited to 'gcc/attribs.c')
-rw-r--r-- | gcc/attribs.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/gcc/attribs.c b/gcc/attribs.c index 9f2f50b..9d76a0c 100644 --- a/gcc/attribs.c +++ b/gcc/attribs.c @@ -286,6 +286,7 @@ decl_attributes (tree *node, tree attributes, int flags) tree *anode = node; const struct attribute_spec *spec = lookup_attribute_spec (name); bool no_add_attrs = 0; + int fn_ptr_quals = 0; tree fn_ptr_tmp = NULL_TREE; if (spec == NULL) @@ -353,6 +354,7 @@ decl_attributes (tree *node, tree attributes, int flags) This would all be simpler if attributes were part of the declarator, grumble grumble. */ fn_ptr_tmp = TREE_TYPE (*anode); + fn_ptr_quals = TYPE_QUALS (*anode); anode = &fn_ptr_tmp; flags &= ~(int) ATTR_FLAG_TYPE_IN_PLACE; } @@ -449,6 +451,8 @@ decl_attributes (tree *node, tree attributes, int flags) /* Rebuild the function pointer type and put it in the appropriate place. */ fn_ptr_tmp = build_pointer_type (fn_ptr_tmp); + if (fn_ptr_quals) + fn_ptr_tmp = build_qualified_type (fn_ptr_tmp, fn_ptr_quals); if (DECL_P (*node)) TREE_TYPE (*node) = fn_ptr_tmp; else |