aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/except.c
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2017-08-29 15:40:14 -0400
committerJason Merrill <jason@gcc.gnu.org>2017-08-29 15:40:14 -0400
commita0ab7ccd216184853052cec1bce7900cbdeed0b4 (patch)
tree29a36ea3eecd68beb15c9eab599e458926584a2b /gcc/cp/except.c
parent12659e10c78200717fc82ed77892de5059fa44b5 (diff)
downloadgcc-a0ab7ccd216184853052cec1bce7900cbdeed0b4.zip
gcc-a0ab7ccd216184853052cec1bce7900cbdeed0b4.tar.gz
gcc-a0ab7ccd216184853052cec1bce7900cbdeed0b4.tar.bz2
Add immediate potential_constant_expression variants.
* constexpr.c (potential_constant_expression_1): Add "now" parm. (is_constant_expression, require_constant_expression): New. (is_static_init_expression, is_nondependent_constant_expression) (is_nondependent_static_init_expression): Drop "potential". * except.c (build_must_not_throw_expr): Do type conversion on value-dependent argument. * pt.c, semantics.c, typeck2.c: Use variants without "potential". From-SVN: r251423
Diffstat (limited to 'gcc/cp/except.c')
-rw-r--r--gcc/cp/except.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/gcc/cp/except.c b/gcc/cp/except.c
index b25b91b..2ee7e97 100644
--- a/gcc/cp/except.c
+++ b/gcc/cp/except.c
@@ -261,13 +261,19 @@ build_must_not_throw_expr (tree body, tree cond)
if (!flag_exceptions)
return body;
- if (cond && !value_dependent_expression_p (cond))
+ if (!cond)
+ /* OK, unconditional. */;
+ else
{
- cond = perform_implicit_conversion_flags (boolean_type_node, cond,
- tf_warning_or_error,
- LOOKUP_NORMAL);
- cond = instantiate_non_dependent_expr (cond);
- cond = cxx_constant_value (cond);
+ tree conv = NULL_TREE;
+ if (!type_dependent_expression_p (cond))
+ conv = perform_implicit_conversion_flags (boolean_type_node, cond,
+ tf_warning_or_error,
+ LOOKUP_NORMAL);
+ if (tree inst = instantiate_non_dependent_or_null (conv))
+ cond = cxx_constant_value (inst);
+ else
+ require_constant_expression (cond);
if (integer_zerop (cond))
return body;
else if (integer_onep (cond))