aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/pt.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2008-03-26 21:34:14 +0100
committerJakub Jelinek <jakub@gcc.gnu.org>2008-03-26 21:34:14 +0100
commitff2f1c5f22e9372be35ae5e03f5d9ada1c4e47da (patch)
treef3c00cfabb1e1de34ce1b74f9890ef3f2d44b1b8 /gcc/cp/pt.c
parent33558d947ce6fb40d78caaa208b394def95269b7 (diff)
downloadgcc-ff2f1c5f22e9372be35ae5e03f5d9ada1c4e47da.zip
gcc-ff2f1c5f22e9372be35ae5e03f5d9ada1c4e47da.tar.gz
gcc-ff2f1c5f22e9372be35ae5e03f5d9ada1c4e47da.tar.bz2
re PR c++/35546 (__attribute__(format...) broken for members of template classes?)
PR c++/35546 * pt.c (apply_late_template_attributes): Don't call tsubst on first attribute argument if it is IDENTIFIER_NODE. * g++.dg/ext/attrib33.C: New test. From-SVN: r133615
Diffstat (limited to 'gcc/cp/pt.c')
-rw-r--r--gcc/cp/pt.c26
1 files changed, 23 insertions, 3 deletions
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index 67d392d..6f7efa6 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -6791,9 +6791,29 @@ apply_late_template_attributes (tree *decl_p, tree attributes, int attr_flags,
{
*p = TREE_CHAIN (t);
TREE_CHAIN (t) = NULL_TREE;
- TREE_VALUE (t)
- = tsubst_expr (TREE_VALUE (t), args, complain, in_decl,
- /*integral_constant_expression_p=*/false);
+ /* If the first attribute argument is an identifier, don't
+ pass it through tsubst. Attributes like mode, format,
+ cleanup and several target specific attributes expect it
+ unmodified. */
+ if (TREE_VALUE (t)
+ && TREE_CODE (TREE_VALUE (t)) == TREE_LIST
+ && TREE_VALUE (TREE_VALUE (t))
+ && (TREE_CODE (TREE_VALUE (TREE_VALUE (t)))
+ == IDENTIFIER_NODE))
+ {
+ tree chain
+ = tsubst_expr (TREE_CHAIN (TREE_VALUE (t)), args, complain,
+ in_decl,
+ /*integral_constant_expression_p=*/false);
+ if (chain != TREE_CHAIN (TREE_VALUE (t)))
+ TREE_VALUE (t)
+ = tree_cons (NULL_TREE, TREE_VALUE (TREE_VALUE (t)),
+ chain);
+ }
+ else
+ TREE_VALUE (t)
+ = tsubst_expr (TREE_VALUE (t), args, complain, in_decl,
+ /*integral_constant_expression_p=*/false);
*q = t;
q = &TREE_CHAIN (t);
}