diff options
author | Marek Polacek <polacek@redhat.com> | 2020-09-21 13:24:25 -0400 |
---|---|---|
committer | Marek Polacek <polacek@redhat.com> | 2020-09-21 18:13:37 -0400 |
commit | defceb206be0f803b8d94e746180e51adad20b87 (patch) | |
tree | 872c615b9b5569c3385d9a387c50266f47ac214b /gcc/cp | |
parent | 7029dfa38b663d20e0de40395fcd45a2845e2f71 (diff) | |
download | gcc-defceb206be0f803b8d94e746180e51adad20b87.zip gcc-defceb206be0f803b8d94e746180e51adad20b87.tar.gz gcc-defceb206be0f803b8d94e746180e51adad20b87.tar.bz2 |
c++: DR 1722: Make lambda to function pointer conv noexcept [PR90583]
DR 1722 clarifies that the conversion function from lambda to pointer to
function should be noexcept(true).
gcc/cp/ChangeLog:
PR c++/90583
DR 1722
* lambda.c (maybe_add_lambda_conv_op): Mark the conversion function
as noexcept.
gcc/testsuite/ChangeLog:
PR c++/90583
DR 1722
* g++.dg/cpp0x/lambda/lambda-conv14.C: New test.
Diffstat (limited to 'gcc/cp')
-rw-r--r-- | gcc/cp/lambda.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/gcc/cp/lambda.c b/gcc/cp/lambda.c index 364a3e9..7fccccc 100644 --- a/gcc/cp/lambda.c +++ b/gcc/cp/lambda.c @@ -1189,6 +1189,8 @@ maybe_add_lambda_conv_op (tree type) tree name = make_conv_op_name (rettype); tree thistype = cp_build_qualified_type (type, TYPE_QUAL_CONST); tree fntype = build_method_type_directly (thistype, rettype, void_list_node); + /* DR 1722: The conversion function should be noexcept. */ + fntype = build_exception_variant (fntype, noexcept_true_spec); tree convfn = build_lang_decl (FUNCTION_DECL, name, fntype); SET_DECL_LANGUAGE (convfn, lang_cplusplus); tree fn = convfn; |