]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR c++/42555 (16-byte aligned double is disallowed only in templates)
authorJason Merrill <jason@redhat.com>
Mon, 4 Jan 2010 17:53:37 +0000 (12:53 -0500)
committerJason Merrill <jason@gcc.gnu.org>
Mon, 4 Jan 2010 17:53:37 +0000 (12:53 -0500)
PR c++/42555
* pt.c (tsubst_decl): Don't apply type attributes in place.

From-SVN: r155628

gcc/cp/ChangeLog
gcc/cp/pt.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/ext/attrib35.C [new file with mode: 0644]

index 77dd1df69540f152beb01f8c400c47f63e49538f..427e57f4f0fb415fc81e66eb9bd377e374a92e3c 100644 (file)
@@ -1,5 +1,8 @@
 2010-01-04  Jason Merrill  <jason@redhat.com>
 
+       PR c++/42555
+       * pt.c (tsubst_decl): Don't apply type attributes in place.
+
        PR c++/42567
        * semantics.c (describable_type): Remove decltype comment and
        semantics.
index d5342a1653fd0700b486a49bb45dfb6c4a8e9bd6..d2a1f9d6e2e5a8f2163dfdaf93e0aa6b5a2d26e0 100644 (file)
@@ -9400,7 +9400,7 @@ tsubst_decl (tree t, tree args, tsubst_flags_t complain)
        TREE_CHAIN (r) = NULL_TREE;
 
        apply_late_template_attributes (&r, DECL_ATTRIBUTES (r),
-                                       (int) ATTR_FLAG_TYPE_IN_PLACE,
+                                       /*flags=*/0,
                                        args, complain, in_decl);
 
        /* Preserve a typedef that names a type.  */
index 8d559e91c3b236d4c5ec8a2a4bf0019d8ff2ad20..aebd716b189a3e186392f7f8bf213ffb9490c5b0 100644 (file)
@@ -1,5 +1,8 @@
 2010-01-04  Jason Merrill  <jason@redhat.com>
 
+       PR c++/42555
+       * g++.dg/ext/attrib35.C: New.
+
        PR c++/42567
        * g++.dg/cpp0x/auto17.C: New.
 
diff --git a/gcc/testsuite/g++.dg/ext/attrib35.C b/gcc/testsuite/g++.dg/ext/attrib35.C
new file mode 100644 (file)
index 0000000..60c4840
--- /dev/null
@@ -0,0 +1,19 @@
+// { dg-do compile { target i*86-*-* x86_64-*-* } }
+// { dg-options "-O3 -msse2" }
+
+// You can make NON-template typedefs with a large alignment.
+typedef double AlignedDoubleType __attribute__((aligned(16)));
+
+template <typename RealType>
+RealType f(const RealType* p)
+{
+  // But if you use a template parameter it complains.
+  typedef RealType AlignedRealType __attribute__((aligned(16)));
+
+  return p[0];
+}
+
+double f2(const double* p)
+{
+  return f<double>(p);
+}