aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/cp/ChangeLog6
-rw-r--r--gcc/cp/tree.c11
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/g++.dg/template/alignof2.C9
4 files changed, 27 insertions, 4 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 232822a..6f93809 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,9 @@
+2012-11-16 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/55337
+ * tree.c (cp_tree_equal) <case ALIGNOF_EXPR>: Use SIZEOF_EXPR_TYPE_P
+ only on SIZEOF_EXPR.
+
2012-11-14 Jason Merrill <jason@redhat.com>
PR c++/54903
diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c
index 5df7b6c..bc81dac 100644
--- a/gcc/cp/tree.c
+++ b/gcc/cp/tree.c
@@ -2610,10 +2610,13 @@ cp_tree_equal (tree t1, tree t2)
tree o1 = TREE_OPERAND (t1, 0);
tree o2 = TREE_OPERAND (t2, 0);
- if (SIZEOF_EXPR_TYPE_P (t1))
- o1 = TREE_TYPE (o1);
- if (SIZEOF_EXPR_TYPE_P (t2))
- o2 = TREE_TYPE (o2);
+ if (code1 == SIZEOF_EXPR)
+ {
+ if (SIZEOF_EXPR_TYPE_P (t1))
+ o1 = TREE_TYPE (o1);
+ if (SIZEOF_EXPR_TYPE_P (t2))
+ o2 = TREE_TYPE (o2);
+ }
if (TREE_CODE (o1) != TREE_CODE (o2))
return false;
if (TYPE_P (o1))
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 6b297ee..d163db2 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2012-11-16 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/55337
+ * g++.dg/template/alignof2.C: New test.
+
2012-11-16 Uros Bizjak <ubizjak@gmail.com>
* g++.dg/mv1.C (dg-options): Add -march=x86-64.
diff --git a/gcc/testsuite/g++.dg/template/alignof2.C b/gcc/testsuite/g++.dg/template/alignof2.C
new file mode 100644
index 0000000..f989898
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/alignof2.C
@@ -0,0 +1,9 @@
+// PR c++/55337
+// { dg-do compile }
+
+template <int> struct A;
+template <typename T> struct B
+{
+ static A <__alignof__ (T)> b;
+};
+template <typename T> A<__alignof__ (T)> B<T>::b;