2003-12-30 Nathan Sidwell <nathan@codesourcery.com>
+ PR c++/13507
+ * decl.c (duplicate_decls): Use build_type_attribute_variant to
+ merge attributes.
+
PR c++/13494
* tree.c (build_cplus_array_type_1): Only build a minimal array
type for dependent types or domains.
for anticipated built-ins, for exception lists, etc... */
else if (DECL_ANTICIPATED (olddecl))
{
- TYPE_ATTRIBUTES (TREE_TYPE (newdecl))
- = (*targetm.merge_type_attributes) (TREE_TYPE (olddecl),
- TREE_TYPE (newdecl));
- TREE_TYPE (olddecl) = TREE_TYPE (newdecl);
+ tree type = TREE_TYPE (newdecl);
+ tree attribs = (*targetm.merge_type_attributes)
+ (TREE_TYPE (olddecl), type);
+
+ type = build_type_attribute_variant (type, attribs);
+ TREE_TYPE (newdecl) = TREE_TYPE (olddecl) = type;
}
/* Whether or not the builtin can throw exceptions has no
2003-12-30 Nathan Sidwell <nathan@codesourcery.com>
+ PR c++/13507
+ * g++.dg/ext/attrib11.C: New test.
+
PR c++/13494
* g++.dg/template/array2-1.C: New test.
* g++.dg/template/array2-2.C: New test.
--- /dev/null
+// { dg-do compile }
+// { dg-options "-Wall" }
+
+// Copyright (C) 2003 Free Software Foundation, Inc.
+// Contributed by Nathan Sidwell 30 Dec 2003 <nathan@codesourcery.com>
+
+
+// PR c++/13507, spurious warning due to attribute clobbering
+extern "C" {
+ extern int printf (__const char *__restrict __format, ...) throw ();
+ extern int scanf (__const char *__restrict __format, ...) throw ();
+}
+
+void foo(unsigned int x)
+{
+ printf ("%d\n", x);
+}