Bug 90583 - Implement DR 1722, lambda to function pointer conversion should be noexcept
Summary: Implement DR 1722, lambda to function pointer conversion should be noexcept
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 10.0
: P3 normal
Target Milestone: ---
Assignee: Marek Polacek
URL:
Keywords: patch
Depends on:
Blocks: c++-core-issues
  Show dependency treegraph
 
Reported: 2019-05-23 00:45 UTC by Marek Polacek
Modified: 2020-09-21 22:14 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2020-09-21 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Marek Polacek 2019-05-23 00:45:16 UTC
Cf. http://wg21.link/cwg1722

void
foo ()
{
  auto l = [](int){ return 42; };
  static_assert(noexcept((int (*)(int))(l)), "");
}
Comment 2 GCC Commits 2020-09-21 22:14:03 UTC
The master branch has been updated by Marek Polacek <mpolacek@gcc.gnu.org>:

https://gcc.gnu.org/g:defceb206be0f803b8d94e746180e51adad20b87

commit r11-3336-gdefceb206be0f803b8d94e746180e51adad20b87
Author: Marek Polacek <polacek@redhat.com>
Date:   Mon Sep 21 13:24:25 2020 -0400

    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.
Comment 3 Marek Polacek 2020-09-21 22:14:40 UTC
Fixed.