diff options
author | Marek Polacek <polacek@redhat.com> | 2024-02-06 15:35:16 -0500 |
---|---|---|
committer | Marek Polacek <polacek@redhat.com> | 2024-02-09 16:37:37 -0500 |
commit | 3a3e0f1b46a3ad71ebeedc419393e3a36f1ce6db (patch) | |
tree | 63cfed92cbd452f83e5e6457ac9c633d201d7f14 /gcc/cp/parser.cc | |
parent | b3d622d70ba209b63471fc1b0970870046e55745 (diff) | |
download | gcc-3a3e0f1b46a3ad71ebeedc419393e3a36f1ce6db.zip gcc-3a3e0f1b46a3ad71ebeedc419393e3a36f1ce6db.tar.gz gcc-3a3e0f1b46a3ad71ebeedc419393e3a36f1ce6db.tar.bz2 |
c++: make build_throw SFINAE-friendly [PR98388]
Here the problem is that we give hard errors while substituting
template parameters during overload resolution of is_throwable
which has an invalid throw in decltype.
The backtrace shows that fn_type_unification -> instantiate_template
-> tsubst* passes complain=0 as expected, but build_throw doesn't
have a complain parameter. So let's add one. Also remove a redundant
local variable which I should have removed in my P2266 patch.
There's still one problem for which I opened <https://gcc.gnu.org/PR113853>.
We need to patch up treat_lvalue_as_rvalue_p and remove the dg-bogus.
Thanks to Patrick for notifying me of this PR. This doesn't fully fix
113789; there I think I'll have to figure our why a candidate wasn't
discarded from the overload set.
PR c++/98388
gcc/cp/ChangeLog:
* coroutines.cc (coro_rewrite_function_body): Pass tf_warning_or_error
to build_throw.
(morph_fn_to_coro): Likewise.
* cp-tree.h (build_throw): Adjust.
* except.cc (expand_end_catch_block): Pass tf_warning_or_error to
build_throw.
(build_throw): Add a tsubst_flags_t parameter. Use it. Remove
redundant variable. Guard an inform call.
* parser.cc (cp_parser_throw_expression): Pass tf_warning_or_error
to build_throw.
* pt.cc (tsubst_expr) <case THROW_EXPR>: Pass complain to build_throw.
libcc1/ChangeLog:
* libcp1plugin.cc (plugin_build_unary_expr): Pass tf_error to
build_throw.
gcc/testsuite/ChangeLog:
* g++.dg/cpp0x/sfinae69.C: New test.
Diffstat (limited to 'gcc/cp/parser.cc')
-rw-r--r-- | gcc/cp/parser.cc | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/gcc/cp/parser.cc b/gcc/cp/parser.cc index c4292c4..09ecfa2 100644 --- a/gcc/cp/parser.cc +++ b/gcc/cp/parser.cc @@ -29310,7 +29310,7 @@ cp_parser_throw_expression (cp_parser* parser) the end at the end of the final token we consumed. */ location_t combined_loc = make_location (start_loc, start_loc, parser->lexer); - expression = build_throw (combined_loc, expression); + expression = build_throw (combined_loc, expression, tf_warning_or_error); return expression; } |