1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
$NetBSD: patch-de,v 1.1 2001/10/21 12:24:16 kent Exp $
--- gcc/cp/decl.c~ Tue Mar 27 22:17:25 2001
+++ gcc/cp/decl.c
@@ -10266,8 +10266,18 @@
ignore_attrs = 0;
else if (inner_attrs)
{
- decl_attributes (type, inner_attrs, NULL_TREE);
- inner_attrs = NULL_TREE;
+ /*decl_attributes (type, inner_attrs, NULL_TREE);*/
+ /* Create a dummy decl to pass to decl_attributes. The
+ attributes will be added to a variant of type, and this
+ new variant type can be retrieved from the dummy decl.
+ Passing type directly causes the attributes to be added
+ to type, which is wrong because type may be used
+ elsewhere without attributes. */
+
+ tree dummy = build_decl (TYPE_DECL, NULL_TREE, type);
+ decl_attributes (dummy, inner_attrs, NULL_TREE);
+ type = TREE_TYPE (dummy);
+ inner_attrs = NULL_TREE;
}
switch (TREE_CODE (declarator))
@@ -10969,7 +10979,19 @@
if (inner_attrs)
{
if (! ignore_attrs)
- decl_attributes (type, inner_attrs, NULL_TREE);
+ /*decl_attributes (type, inner_attrs, NULL_TREE);*/
+ {
+ /* Create a dummy decl to pass to decl_attributes. The
+ attributes will be added to a variant of type, and this
+ new variant type can be retrieved from the dummy decl.
+ Passing type directly causes the attributes to be added
+ to type, which is wrong because type may be used
+ elsewhere without attributes. */
+
+ tree dummy = build_decl (TYPE_DECL, NULL_TREE, type);
+ decl_attributes (dummy, inner_attrs, NULL_TREE);
+ type = TREE_TYPE (dummy);
+ }
else if (attrlist)
TREE_VALUE (attrlist) = chainon (inner_attrs, TREE_VALUE (attrlist));
else
|