This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: C++ PATCH for c++/50800 (ICE with may_alias and templates)
- From: Jason Merrill <jason at redhat dot com>
- To: Markus Trippelsdorf <markus at trippelsdorf dot de>
- Cc: "H.J. Lu" <hjl dot tools at gmail dot com>, gcc-patches List <gcc-patches at gcc dot gnu dot org>
- Date: Wed, 29 Apr 2015 16:50:20 -0400
- Subject: Re: C++ PATCH for c++/50800 (ICE with may_alias and templates)
- Authentication-results: sourceware.org; auth=none
- References: <55391529 dot 6090904 at redhat dot com> <CAMe9rOpW1sGisK9-0BAyNugonTo+qOtyJDwVPn-j5WCjHHgzQQ at mail dot gmail dot com> <553F9C40 dot 7040101 at redhat dot com> <20150429114153 dot GA32249 at x4>
On 04/29/2015 07:41 AM, Markus Trippelsdorf wrote:
I'm getting hundreds of new warnings when building LLVM, e.g.:
Whoops. Fixed thus.
commit 7da5a68ba55cd49c46ff9ac547df59248bd90f7d
Author: Jason Merrill <jason@redhat.com>
Date: Wed Apr 29 16:04:08 2015 -0400
PR c++/50800
* tree.c (apply_identity_attributes): Fix handling of classes.
diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c
index d00f0d7..ec9be8c 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 0000000..aa62e5a
--- /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]); }
+};