aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/parser.h
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2016-08-10 17:58:23 -0400
committerJason Merrill <jason@gcc.gnu.org>2016-08-10 17:58:23 -0400
commit99f9d4b1b6bd7f072a84a0b19f0397bfa50008cb (patch)
tree387fdc4230f85dcbe03d25081a8bef0f7568d826 /gcc/cp/parser.h
parente9e6d4f6cc2c0a3407c527f4c786b46508cb3366 (diff)
downloadgcc-99f9d4b1b6bd7f072a84a0b19f0397bfa50008cb.zip
gcc-99f9d4b1b6bd7f072a84a0b19f0397bfa50008cb.tar.gz
gcc-99f9d4b1b6bd7f072a84a0b19f0397bfa50008cb.tar.bz2
Implement C++17 constexpr if.
* cp-tree.h (IF_STMT_CONSTEXPR_P): New. * name-lookup.c (push_to_top_level, pop_from_top_level_1): Handle it. * parser.h (struct cp_parser): Add in_discarded_stmt field. * parser.c (cp_parser_selection_statement): Handle 'if constexpr'. (cp_parser_jump_statement): Avoid deducing from a discarded return. * pt.c (tsubst_expr): Only instantiate taken branch of constexpr if. * semantics.c (begin_if_stmt): Set the binding level this_entity. (finish_if_stmt_cond): Require the condition of a constexpr if to be constant. * decl.c (level_for_constexpr_if): New. (named_label_entry): Add in_constexpr_if field. (poplevel_named_label_1): Set it. (check_goto): Check it. (check_previous_goto_1): Check level_for_constexpr_if. From-SVN: r239338
Diffstat (limited to 'gcc/cp/parser.h')
-rw-r--r--gcc/cp/parser.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/gcc/cp/parser.h b/gcc/cp/parser.h
index 2d3feb6..6a52b12 100644
--- a/gcc/cp/parser.h
+++ b/gcc/cp/parser.h
@@ -336,6 +336,10 @@ struct GTY(()) cp_parser {
a local class. */
bool in_function_body;
+ /* TRUE if we are parsing a C++17 discarded statement (the non-taken branch
+ of an if constexpr). */
+ bool in_discarded_stmt;
+
/* Nonzero if we're processing a __transaction_atomic or
__transaction_relaxed statement. */
unsigned char in_transaction;