diff options
| author | pinskia <pinskia@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-02-18 19:11:58 +0000 |
|---|---|---|
| committer | pinskia <pinskia@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-02-18 19:11:58 +0000 |
| commit | e4ac42e243f6cb0cb92f4bf19560eddfda62bba0 (patch) | |
| tree | c9e53c3d1b5552f20cf65784987f33ce34aad1bd | |
| parent | a9dd2464a0e9e57fee758a3345a029bdc63edf1f (diff) | |
| download | ppe42-gcc-e4ac42e243f6cb0cb92f4bf19560eddfda62bba0.tar.gz ppe42-gcc-e4ac42e243f6cb0cb92f4bf19560eddfda62bba0.zip | |
2005-01-20 Giovanni Bajo <giovannibajo@gcc.gnu.org>
PR c++/19508
* g++.dg/ext/attrib20.C: New test.
2005-01-20 Giovanni Bajo <giovannibajo@gcc.gnu.org>
PR c++/19508
* decl2.c (grokfield): Do not apply attributes to template parameters
as they are ignored by tsubst anyway.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@95230 138bc75d-0d04-0410-961f-82ee72b054a4
| -rw-r--r-- | gcc/cp/ChangeLog | 6 | ||||
| -rw-r--r-- | gcc/cp/decl2.c | 11 | ||||
| -rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
| -rw-r--r-- | gcc/testsuite/g++.dg/ext/attrib20.C | 23 |
4 files changed, 44 insertions, 1 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 61cd6702c30..ab452e996db 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2005-01-20 Giovanni Bajo <giovannibajo@gcc.gnu.org> + + PR c++/19508 + * decl2.c (grokfield): Do not apply attributes to template parameters + as they are ignored by tsubst anyway. + 2005-02-18 Jakub Jelinek <jakub@redhat.com> PR c++/19813 diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c index c7b04150e8f..113386a880f 100644 --- a/gcc/cp/decl2.c +++ b/gcc/cp/decl2.c @@ -878,7 +878,16 @@ grokfield (const cp_declarator *declarator, value = push_template_decl (value); if (attrlist) - cplus_decl_attributes (&value, attrlist, 0); + { + /* Avoid storing attributes in template parameters: + tsubst is not ready to handle them. */ + tree type = TREE_TYPE (value); + if (TREE_CODE (type) == TEMPLATE_TYPE_PARM + || TREE_CODE (type) == BOUND_TEMPLATE_TEMPLATE_PARM) + sorry ("applying attributes to template parameters is not implemented"); + else + cplus_decl_attributes (&value, attrlist, 0); + } return value; } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 581e21a9028..5eb642ece86 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2005-01-20 Giovanni Bajo <giovannibajo@gcc.gnu.org> + + PR c++/19508 + * g++.dg/ext/attrib20.C: New test. + 2004-02-18 Andrew Pinski <pinskia@physics.uc.edu> PR middle-end/20030 diff --git a/gcc/testsuite/g++.dg/ext/attrib20.C b/gcc/testsuite/g++.dg/ext/attrib20.C new file mode 100644 index 00000000000..e46e8ae2077 --- /dev/null +++ b/gcc/testsuite/g++.dg/ext/attrib20.C @@ -0,0 +1,23 @@ +// { dg-do compile } +// { dg-options "-g" } +// Origin: <jan at etpmod dot phys dot tue dot nl> +// PR c++/19508: avoid attributes for template parameters + +template <typename T> +struct BVector +{ + typedef T T2; + typedef T value_type __attribute__ ((aligned(8))); // { dg-bogus "attribute" "attribute" { xfail *-*-* } } + typedef T2 value_type2 __attribute__ ((aligned(8))); // { dg-bogus "attribute" "attribute" { xfail *-*-* } } + value_type v; +}; +BVector<int> m; + +template <template <class> class T> +struct BV2 +{ + typedef T<float> value_type __attribute__((aligned(8))); // { dg-bogus "attribute" "attribute" { xfail *-*-* } } + value_type v; +}; +BV2<BVector> m2; + |

