diff options
author | Marek Polacek <polacek@redhat.com> | 2020-01-22 11:44:13 -0500 |
---|---|---|
committer | Marek Polacek <polacek@redhat.com> | 2020-01-22 11:44:13 -0500 |
commit | 15ed55eabb0cf8a2974b8025a9f46c9e58960811 (patch) | |
tree | 4f2efc2b13abc0a38a5ff2385d61e6ef30fd27a0 /gcc/cp/semantics.c | |
parent | bf91504dc23f17248df6302f7bad849f3ddedee7 (diff) | |
download | gcc-15ed55eabb0cf8a2974b8025a9f46c9e58960811.zip gcc-15ed55eabb0cf8a2974b8025a9f46c9e58960811.tar.gz gcc-15ed55eabb0cf8a2974b8025a9f46c9e58960811.tar.bz2 |
PR c++/93324 - ICE with -Wall on constexpr if.
This is a crash with constexpr if, when trying to see if the call in
the if-statement is std::is_constant_evaluated.
cp_get_callee_fndecl_nofold can return NULL_TREE and fndecl_built_in_p
doesn't expect to get a null tree, so check FNDECL first.
Diffstat (limited to 'gcc/cp/semantics.c')
-rw-r--r-- | gcc/cp/semantics.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c index 3669b24..3b88f15 100644 --- a/gcc/cp/semantics.c +++ b/gcc/cp/semantics.c @@ -734,6 +734,9 @@ is_std_constant_evaluated_p (tree fn) return false; tree fndecl = cp_get_callee_fndecl_nofold (fn); + if (fndecl == NULL_TREE) + return false; + if (fndecl_built_in_p (fndecl, CP_BUILT_IN_IS_CONSTANT_EVALUATED, BUILT_IN_FRONTEND)) return true; |