Message ID | 20160108174856.GL31604@redhat.com |
---|---|
State | New |
Headers | show |
On 01/08/2016 12:48 PM, Marek Polacek wrote: > if (tree *p = ctx->values->get (r)) > r = *p; > - if (DECL_P (r)) > + if (r == NULL_TREE || DECL_P (r)) I think it would be a bit better not to change r if *p is null. OK with that change. Jason
diff --git gcc/cp/constexpr.c gcc/cp/constexpr.c index bcf26a6..f59d010 100644 --- gcc/cp/constexpr.c +++ gcc/cp/constexpr.c @@ -3195,7 +3195,7 @@ cxx_eval_constant_expression (const constexpr_ctx *ctx, tree t, if (VAR_P (r)) if (tree *p = ctx->values->get (r)) r = *p; - if (DECL_P (r)) + if (r == NULL_TREE || DECL_P (r)) { if (!ctx->quiet) non_const_var_error (r); diff --git gcc/testsuite/g++.dg/pr68449.C gcc/testsuite/g++.dg/pr68449.C index e69de29..7d86fe9 100644 --- gcc/testsuite/g++.dg/pr68449.C +++ gcc/testsuite/g++.dg/pr68449.C @@ -0,0 +1,9 @@ +// PR c++/68449 +// { dg-do compile } +// { dg-options "-Wsign-compare" } + +int +foo (int a) +{ + return __extension__ ({ int b; b; }) < 0; +}