+2010-04-27 Richard Guenther <rguenther@suse.de>
+
+ Backport from mainline:
+ 2010-03-19 Michael Matz <matz@suse.de>
+
+ PR c++/43116
+ * attribs.c (decl_attributes): When rebuilding a function pointer
+ type use the same qualifiers as the original pointer type.
+
2010-04-20 Richard Guenther <rguenther@suse.de>
Backport from mainline
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)
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;
}
/* 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
+2010-04-27 Richard Guenther <rguenther@suse.de>
+
+ Backport from mainline:
+ 2010-03-19 Michael Matz <matz@suse.de>
+
+ PR c++/43116
+ * g++.dg/other/pr43116.C: New testcase.
+
2010-04-20 Richard Guenther <rguenther@suse.de>
Backport from mainline:
--- /dev/null
+/* { dg-do compile } */
+extern "C" int rpl_open (const char *filename, int flags, ...) __attribute__
+((__nonnull__ (1)));
+
+namespace gnulib
+{
+ int (*const open) (const char *filename, int flags, ...) __attribute__
+ ((__nonnull__ (1))) = rpl_open;
+}