This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/80562] [7/8 Regression] ICE using if constexpr with nonconstant expression in function template
- From: "mpolacek at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 02 May 2017 15:53:28 +0000
- Subject: [Bug c++/80562] [7/8 Regression] ICE using if constexpr with nonconstant expression in function template
- Auto-submitted: auto-generated
- References: <bug-80562-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80562
Marek Polacek <mpolacek at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2017-05-02
CC| |mpolacek at gcc dot gnu.org
Target Milestone|--- |7.2
Summary|ICE using if constexpr with |[7/8 Regression] ICE using
|nonconstant expression in |if constexpr with
|function template |nonconstant expression in
| |function template
Ever confirmed|0 |1
--- Comment #1 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
commit df5390a9de5322cbaab3def921d3d517d4494144
Author: jason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
Date: Wed Aug 10 21:58:23 2016 +0000
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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@239338
138bc75d-0d04-0410-961f-82ee72b054a4