summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>2015-04-29 20:51:05 +0000
committerjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>2015-04-29 20:51:05 +0000
commit3c5484219dc1e9b6b9b772d0f6d0e5f38282ebf3 (patch)
tree33bcfae4e692d9bc6f67a852a2be730d152ffd58
parent9866562d1f3e55459a8427dc2db205d2750d48be (diff)
downloadgcc-3c5484219dc1e9b6b9b772d0f6d0e5f38282ebf3.tar.gz
PR c++/50800
* tree.c (apply_identity_attributes): Fix handling of classes. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@222591 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/cp/ChangeLog5
-rw-r--r--gcc/cp/tree.c7
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/alignas3.C20
3 files changed, 32 insertions, 0 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 9442faa9c40..d78b22f1955 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,8 @@
+2015-04-29 Jason Merrill <jason@redhat.com>
+
+ PR c++/50800
+ * tree.c (apply_identity_attributes): Fix handling of classes.
+
2015-04-29 Thomas Schwinge <thomas@codesourcery.com>
* parser.c (cp_parser_oacc_enter_exit_data): Use
diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c
index d00f0d7eab1..ec9be8c2bc4 100644
--- a/gcc/cp/tree.c
+++ b/gcc/cp/tree.c
@@ -1187,6 +1187,13 @@ apply_identity_attributes (tree result, tree attribs, bool *remove_attributes)
tree new_attribs = NULL_TREE;
tree *p = &new_attribs;
+ if (OVERLOAD_TYPE_P (result))
+ {
+ /* On classes and enums all attributes are ingrained. */
+ gcc_assert (attribs == TYPE_ATTRIBUTES (result));
+ return result;
+ }
+
for (tree a = attribs; a; a = TREE_CHAIN (a))
{
const attribute_spec *as
diff --git a/gcc/testsuite/g++.dg/cpp0x/alignas3.C b/gcc/testsuite/g++.dg/cpp0x/alignas3.C
new file mode 100644
index 00000000000..aa62e5afb2d
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/alignas3.C
@@ -0,0 +1,20 @@
+// PR c++/50800
+// { dg-do compile { target c++11 } }
+
+template <typename> struct A;
+template <typename _Up> struct A<_Up *> { typedef _Up type; };
+template <typename T> struct B { typedef typename A<T>::type type; };
+template <typename> struct C;
+template <typename From> struct C<const From> {
+ typedef typename B<From>::type SimpleType;
+};
+template <class> struct D { typedef int ret_type; };
+template <class From> struct F {
+ typedef typename D<typename C<From>::SimpleType>::ret_type ret_type;
+};
+template <class, class Y> typename F<Y>::ret_type cast(Y &);
+class CompoundStmt;
+class alignas(8) Stmt {
+ Stmt *Children[1];
+ CompoundStmt *getBlock() const { cast<CompoundStmt>(Children[0]); }
+};