Commit 9dc20710 by Jason Merrill Committed by Jason Merrill

PR c++/84421 - type-dependent if constexpr

	* semantics.c (finish_if_stmt_cond): Check
	type_dependent_expression_p.

From-SVN: r257744
parent c3ab26e8
2018-02-16 Jason Merrill <jason@redhat.com>
PR c++/84421 - type-dependent if constexpr
* semantics.c (finish_if_stmt_cond): Check type_dependent_expression_p.
2018-02-16 Nathan Sidwell <nathan@acm.org>
Deprecate -ffriend-injection.
......
......@@ -731,6 +731,7 @@ finish_if_stmt_cond (tree cond, tree if_stmt)
{
cond = maybe_convert_cond (cond);
if (IF_STMT_CONSTEXPR_P (if_stmt)
&& !type_dependent_expression_p (cond)
&& require_constant_expression (cond)
&& !value_dependent_expression_p (cond))
{
......
// PR c++/84421
// { dg-options -std=c++17 }
struct A{
constexpr operator bool() const { return true; }
};
int main(){
auto f = [](auto v){
if constexpr(v){}
};
A a;
f(a);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment