From da48fb101e2d50af2e4c9ca609bc07a3e0b2e924 Mon Sep 17 00:00:00 2001 From: jakub Date: Tue, 9 Nov 2010 11:52:59 +0000 Subject: PR c++/45894 * tree.c (lvalue_kind): Don't crash if ref has NULL type. * g++.dg/warn/Wsequence-point-2.C: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@166481 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/cp/ChangeLog | 5 +++++ gcc/cp/tree.c | 3 ++- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/g++.dg/warn/Wsequence-point-2.C | 28 +++++++++++++++++++++++++++ 4 files changed, 40 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/g++.dg/warn/Wsequence-point-2.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 7223529dd36..51e21714091 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2010-11-09 Jakub Jelinek + + PR c++/45894 + * tree.c (lvalue_kind): Don't crash if ref has NULL type. + 2010-11-08 Jason Merrill PR c++/46382 diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c index 462e35f3b71..ba8e9784293 100644 --- a/gcc/cp/tree.c +++ b/gcc/cp/tree.c @@ -67,7 +67,8 @@ lvalue_kind (const_tree ref) == REFERENCE_TYPE) return lvalue_kind (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)) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index f8c121efefe..e0f6069a7d2 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2010-11-09 Jakub Jelinek + + PR c++/45894 + * g++.dg/warn/Wsequence-point-2.C: New test. + 2010-11-09 Janus Weil PR fortran/46313 diff --git a/gcc/testsuite/g++.dg/warn/Wsequence-point-2.C b/gcc/testsuite/g++.dg/warn/Wsequence-point-2.C new file mode 100644 index 00000000000..ab9c97a8094 --- /dev/null +++ b/gcc/testsuite/g++.dg/warn/Wsequence-point-2.C @@ -0,0 +1,28 @@ +// PR c++/45894 +// { dg-do compile } +// { dg-options "-std=c++0x -Wsequence-point" } + +struct F +{ + template + void bar (); +}; +template +struct V +{ + V (const V &) { F::bar <>; } +}; +struct C +{ + V <> v; +}; +struct B +{ + C f (); +}; +struct A +{ + C c; + B b; + A () : c (b.f ()) { } +}; -- cgit v1.2.1