public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [C++ PATCH] Fix checking failure in cp_tree_equal with ALIGNOF_EXPR (PR PR c++/55337)
@ 2012-11-15 20:06 Jakub Jelinek
  2012-11-15 20:24 ` Jason Merrill
  0 siblings, 1 reply; 2+ messages in thread
From: Jakub Jelinek @ 2012-11-15 20:06 UTC (permalink / raw)
  To: Jason Merrill; +Cc: gcc-patches

Hi!

case SIZEOF_EXPR: shares the code with case ALIGNOF_EXPR, but only on the
former one can use SIZEOF_EXPR_TYPE_P.  Fixed thusly,
bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?

2012-11-15  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.

	* g++.dg/template/alignof2.C: New test.

--- gcc/cp/tree.c.jj	2012-11-12 11:23:01.000000000 +0100
+++ gcc/cp/tree.c	2012-11-15 10:57:09.073103517 +0100
@@ -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))
--- gcc/testsuite/g++.dg/template/alignof2.C.jj	2012-11-15 11:00:36.126424342 +0100
+++ gcc/testsuite/g++.dg/template/alignof2.C	2012-11-15 11:00:55.144370137 +0100
@@ -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;

	Jakub

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [C++ PATCH] Fix checking failure in cp_tree_equal with ALIGNOF_EXPR (PR PR c++/55337)
  2012-11-15 20:06 [C++ PATCH] Fix checking failure in cp_tree_equal with ALIGNOF_EXPR (PR PR c++/55337) Jakub Jelinek
@ 2012-11-15 20:24 ` Jason Merrill
  0 siblings, 0 replies; 2+ messages in thread
From: Jason Merrill @ 2012-11-15 20:24 UTC (permalink / raw)
  To: Jakub Jelinek; +Cc: gcc-patches

OK.

Jason

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-11-15 20:24 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-11-15 20:06 [C++ PATCH] Fix checking failure in cp_tree_equal with ALIGNOF_EXPR (PR PR c++/55337) Jakub Jelinek
2012-11-15 20:24 ` Jason Merrill

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).