From: mpolacek Date: Tue, 15 Mar 2016 21:10:11 +0000 (+0000) Subject: PR c++/70209 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=0dd1d57fd94190d0129f06fbaf930af29e2f086c;p=thirdparty%2Fgcc.git PR c++/70209 * tree.c (strip_typedefs): Call strip_typedefs again on the DECL_ORIGINAL_TYPE result. * g++.dg/ext/attribute-may-alias-4.C: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@234234 138bc75d-0d04-0410-961f-82ee72b054a4 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index eff989b160fe..4499284e65cb 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2016-03-15 Marek Polacek + + PR c++/70209 + * tree.c (strip_typedefs): Call strip_typedefs again on the + DECL_ORIGINAL_TYPE result. + 2016-03-15 Jason Merrill PR c++/70095 diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c index aaf9a4f2188a..f7849522781c 100644 --- a/gcc/cp/tree.c +++ b/gcc/cp/tree.c @@ -1460,9 +1460,12 @@ strip_typedefs (tree t, bool *remove_attributes) if (!result) { if (typedef_variant_p (t)) - /* Explicitly get the underlying type, as TYPE_MAIN_VARIANT doesn't - strip typedefs with attributes. */ - result = TYPE_MAIN_VARIANT (DECL_ORIGINAL_TYPE (TYPE_NAME (t))); + { + /* Explicitly get the underlying type, as TYPE_MAIN_VARIANT doesn't + strip typedefs with attributes. */ + result = TYPE_MAIN_VARIANT (DECL_ORIGINAL_TYPE (TYPE_NAME (t))); + result = strip_typedefs (result); + } else result = TYPE_MAIN_VARIANT (t); } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 2a76ef0ae2dc..3eb5710fd86a 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2016-03-15 Marek Polacek + + PR c++/70209 + * g++.dg/ext/attribute-may-alias-4.C: New test. + 2016-03-15 Alexander Monakov * g++.dg/pr63384.C: Add -w to dg-options. Remove '-toggle' in diff --git a/gcc/testsuite/g++.dg/ext/attribute-may-alias-4.C b/gcc/testsuite/g++.dg/ext/attribute-may-alias-4.C new file mode 100644 index 000000000000..a459d49e9ee6 --- /dev/null +++ b/gcc/testsuite/g++.dg/ext/attribute-may-alias-4.C @@ -0,0 +1,17 @@ +// PR c++/70209 + +struct V { + typedef float F; + template void m_fn1(S); +}; + +template struct A { + typedef V::F Ta __attribute__((__may_alias__)); + Ta *m_data; + void m_fn2(V &); +}; + +template <> +void A::m_fn2(V &p) { + p.m_fn1(m_data); +}