From b2febff9b75efcb419fcf5d8d821175300fa00b5 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Mon, 30 Jun 2008 22:41:29 +0200 Subject: [PATCH] re PR c++/36662 (vector vs template) PR c++/36662 * decl2.c (is_late_template_attribute): If the first attribute argument is IDENTIFIER_NODE, don't consider it when checking if arguments are value or type dependent. * g++.dg/ext/altivec-16.C: New test. From-SVN: r137287 --- gcc/ChangeLog | 7 +++++++ gcc/cp/decl2.c | 11 ++++++++++- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/g++.dg/ext/altivec-16.C | 19 +++++++++++++++++++ 4 files changed, 41 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/g++.dg/ext/altivec-16.C diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 7c7fd12fe71..cfa46268513 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2008-06-30 Jakub Jelinek + + PR c++/36662 + * decl2.c (is_late_template_attribute): If the first attribute + argument is IDENTIFIER_NODE, don't consider it when checking + if arguments are value or type dependent. + 2008-06-30 Kenneth Zadeck * ifcvt.c (cond_move_process_if_block): Free vectors on false diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c index ee229f4e878..a5ece9a6709 100644 --- a/gcc/cp/decl2.c +++ b/gcc/cp/decl2.c @@ -1,6 +1,7 @@ /* Process declarations and variables for C++ compiler. Copyright (C) 1988, 1992, 1993, 1994, 1995, 1996, 1997, 1998, - 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008 Free Software Foundation, Inc. + 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008 + Free Software Foundation, Inc. Hacked by Michael Tiemann (tiemann@cygnus.com) This file is part of GCC. @@ -1005,6 +1006,14 @@ is_late_template_attribute (tree attr, tree decl) for (arg = args; arg; arg = TREE_CHAIN (arg)) { tree t = TREE_VALUE (arg); + + /* If the first attribute argument is an identifier, only consider + second and following arguments. Attributes like mode, format, + cleanup and several target specific attributes aren't late + just because they have an IDENTIFIER_NODE as first argument. */ + if (arg == args && TREE_CODE (t) == IDENTIFIER_NODE) + continue; + if (value_dependent_expression_p (t) || type_dependent_expression_p (t)) return true; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index a23526877dd..f1ca63236b2 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2008-06-30 Jakub Jelinek + + PR c++/36662 + * g++.dg/ext/altivec-16.C: New test. + 2008-06-30 Ira Rosen PR tree-optimization/36648 diff --git a/gcc/testsuite/g++.dg/ext/altivec-16.C b/gcc/testsuite/g++.dg/ext/altivec-16.C new file mode 100644 index 00000000000..91230d26138 --- /dev/null +++ b/gcc/testsuite/g++.dg/ext/altivec-16.C @@ -0,0 +1,19 @@ +// PR c++/36662 +// { dg-do compile { target powerpc*-*-* } } +// { dg-require-effective-target powerpc_altivec_ok } +// { dg-options "-maltivec" } + +#define vector __attribute__((altivec (vector__))) + +template struct S {}; + +template <> struct S +{ + static vector float zero; +}; + +template +void g (void) +{ + vector float t = S::zero; +} -- 2.30.2