aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/pt.c
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2021-08-30 18:42:05 -0400
committerJason Merrill <jason@redhat.com>2021-08-31 12:17:19 -0400
commit9aeadd8c319d5d940fa4dc91a393fc2959d27719 (patch)
tree27b1c3b13691e8266d10fd240ea7e28d423dbe68 /gcc/cp/pt.c
parent18f0e57b9a2f1b108831fcfb25cbcc4e2de65e8e (diff)
downloadgcc-9aeadd8c319d5d940fa4dc91a393fc2959d27719.zip
gcc-9aeadd8c319d5d940fa4dc91a393fc2959d27719.tar.gz
gcc-9aeadd8c319d5d940fa4dc91a393fc2959d27719.tar.bz2
c++: Improve error recovery with constexpr [PR92193]
The compiler tries to limit error cascades in limit_bad_template_recursion by avoiding triggering a new instantiation from one that has caused errors. We were exempting constexpr functions from this because they can be needed for constant evaluation, but as more and more functions get marked constexpr, this becomes an over-broad category. So as suggested on IRC, this patch only exempts functions that are needed for mandatory constant evaluation. As noted in the comment, this flag doesn't particularly need to use a bit in the FUNCTION_DECL, but there were still some free. PR c++/92193 gcc/cp/ChangeLog: * cp-tree.h (FNDECL_MANIFESTLY_CONST_EVALUATED): New. * constexpr.c (cxx_eval_call_expression): Set it. * pt.c (neglectable_inst_p): Check it. gcc/testsuite/ChangeLog: * g++.dg/diagnostic/static_assert4.C: New test.
Diffstat (limited to 'gcc/cp/pt.c')
-rw-r--r--gcc/cp/pt.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index fcf3ac3..72b22d8 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -10873,7 +10873,8 @@ neglectable_inst_p (tree d)
{
return (d && DECL_P (d)
&& !undeduced_auto_decl (d)
- && !(TREE_CODE (d) == FUNCTION_DECL ? DECL_DECLARED_CONSTEXPR_P (d)
+ && !(TREE_CODE (d) == FUNCTION_DECL
+ ? FNDECL_MANIFESTLY_CONST_EVALUATED (d)
: decl_maybe_constant_var_p (d)));
}