diff options
author | Jason Merrill <jason@redhat.com> | 2016-07-15 14:38:40 -0400 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2016-07-15 14:38:40 -0400 |
commit | 1019d191806b61fb07a4197bf769b4508a572d9c (patch) | |
tree | 6b9c45a80ceb8d4a14f8fc063a3e9bd8f0fcb2e7 /gcc | |
parent | 37a92c0ca231f3767dd905f155fb8d9a20369f2b (diff) | |
download | gcc-1019d191806b61fb07a4197bf769b4508a572d9c.zip gcc-1019d191806b61fb07a4197bf769b4508a572d9c.tar.gz gcc-1019d191806b61fb07a4197bf769b4508a572d9c.tar.bz2 |
PR c++/71513 - alignas on member enum in template
* pt.c (tsubst_attributes): Fix loop logic.
From-SVN: r238392
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/cp/ChangeLog | 3 | ||||
-rw-r--r-- | gcc/cp/pt.c | 19 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/cpp0x/alignas7.C | 13 |
3 files changed, 27 insertions, 8 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 14bcf8e..84106b8 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,8 @@ 2016-07-15 Jason Merrill <jason@redhat.com> + PR c++/71513 + * pt.c (tsubst_attributes): Fix loop logic. + PR c++/71604 PR c++/54430 * parser.c (cp_parser_range_for): Modify IDENTIFIER_BINDING directly. diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index de70fb2..1fbf546 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -9713,20 +9713,23 @@ tsubst_attributes (tree attributes, tree args, } if (last_dep) - for (tree *p = &attributes; *p; p = &TREE_CHAIN (*p)) + for (tree *p = &attributes; *p; ) { tree t = *p; if (ATTR_IS_DEPENDENT (t)) { tree subst = tsubst_attribute (t, NULL, args, complain, in_decl); - if (subst == t) - continue; - *p = subst; - do - p = &TREE_CHAIN (*p); - while (*p); - *p = TREE_CHAIN (t); + if (subst != t) + { + *p = subst; + do + p = &TREE_CHAIN (*p); + while (*p); + *p = TREE_CHAIN (t); + continue; + } } + p = &TREE_CHAIN (*p); } return attributes; diff --git a/gcc/testsuite/g++.dg/cpp0x/alignas7.C b/gcc/testsuite/g++.dg/cpp0x/alignas7.C new file mode 100644 index 0000000..a209250 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/alignas7.C @@ -0,0 +1,13 @@ +// PR c++/71513 +// { dg-do compile { target c++11 } } + +template < int N, typename T > +struct A +{ + enum alignas (N) E : T; +}; + +#define SA(X) static_assert((X), #X) + +constexpr int al = alignof(double); +SA(alignof(A<al,char>::E) == al); |