diff options
| author | mmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-04-05 17:35:54 +0000 |
|---|---|---|
| committer | mmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-04-05 17:35:54 +0000 |
| commit | 1cb8ea17a4f5f39fc75b2200ca4108760701ebdd (patch) | |
| tree | 87bdb49d532ac4a493ba23bdf9892373bc4d56b1 | |
| parent | 2202f4081a4394048e68b9d24bcbf7c90eb3784a (diff) | |
| download | ppe42-gcc-1cb8ea17a4f5f39fc75b2200ca4108760701ebdd.tar.gz ppe42-gcc-1cb8ea17a4f5f39fc75b2200ca4108760701ebdd.zip | |
PR c++/20673
* decl.c (grokdeclarator): Correct attribute handling.
PR c++/20673
* g++.dg/ext/attrib21.C: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@97640 138bc75d-0d04-0410-961f-82ee72b054a4
| -rw-r--r-- | gcc/cp/decl.c | 11 | ||||
| -rw-r--r-- | gcc/testsuite/g++.dg/ext/attrib21.C | 17 |
2 files changed, 23 insertions, 5 deletions
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index eef2cb1744a..9618b4d3c2c 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -7059,9 +7059,7 @@ grokdeclarator (const cp_declarator *declarator, /* Determine the type of the entity declared by recurring on the declarator. */ - for (; - declarator && declarator->kind != cdk_id; - declarator = declarator->declarator) + for (; declarator; declarator = declarator->declarator) { const cp_declarator *inner_declarator; tree attrs; @@ -7069,8 +7067,6 @@ grokdeclarator (const cp_declarator *declarator, if (type == error_mark_node) return error_mark_node; - inner_declarator = declarator->declarator; - attrs = declarator->attributes; if (attrs) { @@ -7088,6 +7084,11 @@ grokdeclarator (const cp_declarator *declarator, attr_flags); } + if (declarator->kind == cdk_id) + break; + + inner_declarator = declarator->declarator; + switch (declarator->kind) { case cdk_array: diff --git a/gcc/testsuite/g++.dg/ext/attrib21.C b/gcc/testsuite/g++.dg/ext/attrib21.C new file mode 100644 index 00000000000..c7ce8da87c7 --- /dev/null +++ b/gcc/testsuite/g++.dg/ext/attrib21.C @@ -0,0 +1,17 @@ +// PR c++/20673 + +typedef void *voidp; + +struct S +{ + char a; + voidp __attribute__ ((aligned (16))) b; +}; + +struct T +{ + char a; + void *__attribute__ ((aligned (16))) b; +}; + +int f[sizeof (struct S) != sizeof (struct T) ? -1 : 1]; |

