[PATCH] fix c++/47589 - backport to 4.4 branch
Jonathan Wakely
jwakely.gcc@gmail.com
Thu Feb 3 00:19:00 GMT 2011
this patch fixes PR c++/47589 (a 4.3/4.4 ice-on-valid-code regression)
by backporting Jakub's fix for c++/45894, which was caused by the same
problem but only manifested with -std=c++0x -Wsequence-point
Jakub's new test doesn't compile on the 4.4 branch, so this adds a new
test reduced from the original reproducer attached to c++/47589
Tested x86_64-linux, OK for 4.4?
==> cp/ChangeLog <==
2011-02-02 Jonathan Wakely <jwakely.gcc@gmail.com>
PR c++/47589
Backport from mainline
2010-11-09 Jakub Jelinek <jakub@redhat.com>
PR c++/45894
* tree.c (lvalue_kind): Don't crash if ref has NULL type.
==> testsuite/ChangeLog <==
2011-02-02 Jonathan Wakely <jwakely.gcc@gmail.com>
PR c++/47589
* g++.dg/pr47589.C: New test.
Should I also check the new test into the 4.5 branch and trunk to
avoid future regressions?
-------------- next part --------------
Index: cp/tree.c
===================================================================
--- cp/tree.c (revision 169769)
+++ cp/tree.c (working copy)
@@ -72,7 +72,8 @@ lvalue_p_1 (tree ref)
== REFERENCE_TYPE)
return lvalue_p_1 (TREE_OPERAND (ref, 0));
- if (TREE_CODE (TREE_TYPE (ref)) == REFERENCE_TYPE)
+ if (TREE_TYPE (ref)
+ && TREE_CODE (TREE_TYPE (ref)) == REFERENCE_TYPE)
{
/* unnamed rvalue references are rvalues */
if (TYPE_REF_IS_RVALUE (TREE_TYPE (ref))
Index: testsuite/g++.dg/pr47589.C
===================================================================
--- testsuite/g++.dg/pr47589.C (revision 0)
+++ testsuite/g++.dg/pr47589.C (revision 0)
@@ -0,0 +1,26 @@
+// PR c++/47589
+// { dg-do compile }
+
+struct F
+{
+ typedef void(*Cb)();
+
+ F(Cb);
+};
+
+struct C
+{
+ template<class D> static void f();
+};
+
+template<class D>
+struct TF : F
+{
+ TF() : F(C::f<D>) { }
+};
+
+struct DTC : TF<DTC>
+{
+ DTC() { }
+};
+
More information about the Gcc-patches
mailing list