re PR c++/56895 (ICE: unexpected expression of kind arrow_expr)

PR c++/56895
	* call.c (null_ptr_cst_p): Call fold_non_dependent_expr_sfinae before
	calling maybe_constant_value for C++98.

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

From-SVN: r197824
This commit is contained in:
Jakub Jelinek 2013-04-11 21:42:33 +02:00 committed by Jakub Jelinek
parent a2a5f18ea7
commit 43a8d6ccf2
4 changed files with 31 additions and 1 deletions

View File

@ -1,3 +1,9 @@
2013-04-11 Jakub Jelinek <jakub@redhat.com>
PR c++/56895
* call.c (null_ptr_cst_p): Call fold_non_dependent_expr_sfinae before
calling maybe_constant_value for C++98.
2013-04-11 Jason Merrill <jason@redhat.com>
PR c++/56901

View File

@ -555,7 +555,7 @@ null_ptr_cst_p (tree t)
{
/* Core issue 903 says only literal 0 is a null pointer constant. */
if (cxx_dialect < cxx0x)
t = maybe_constant_value (t);
t = maybe_constant_value (fold_non_dependent_expr_sfinae (t, tf_none));
STRIP_NOPS (t);
if (integer_zerop (t) && !TREE_OVERFLOW (t))
return true;

View File

@ -1,3 +1,8 @@
2013-04-11 Jakub Jelinek <jakub@redhat.com>
PR c++/56895
* g++.dg/template/arrow4.C: New test.
2013-04-11 Eric Botcazou <ebotcazou@adacore.com>
* gnat.dg/array23.adb: New test.

View File

@ -0,0 +1,19 @@
// PR c++/56895
// { dg-do compile }
void fn (int *);
void fn (int);
extern struct A { bool foo (); A bar (); } *a;
template <int>
void
baz ()
{
fn (a->bar().foo() ? 1 : 0);
}
void
test ()
{
baz<0> ();
}