- Title
- Should lambda to function pointer conversion function be noexcept?
- Status
- cd4
- Section
- 7.5.6.2 [expr.prim.lambda.closure]
- Submitter
- Ville Voutilainen
Created on 2013-07-31.00:00:00 last changed 116 months ago
Messages
Date: 2015-10-15.00:00:00
[Moved to DR at the October, 2015 meeting.]
Date: 2015-05-15.00:00:00
Proposed resolution (May, 2015): Change 7.5.6 [expr.prim.lambda] paragraph 6 as follows: The closure type for a non-generic lambda-expression
with no lambda-capture has a —end example] The conversion function or
conversion function template is public, non-virtual, non-explicit,
const, and has a non-throwing exception specification
(14.5 [except.spec]).
public non-virtual
non-explicit const conversion function to pointer to
function with C++ language linkage
(9.12 [dcl.link]) having the same parameter and
return types as the closure type's function call
operator. The value returned by this conversion function
shall be the address of a function that, when invoked, has
the same effect as invoking the closure type's function call
operator. For a generic lambda with
no lambda-capture, the closure type has a public
non-virtual non-explicit const conversion function template
to pointer to function. The conversion function template...
[Example:
auto GL = [](auto a) { std::cout << a; return a; };
int (*GL_int)(int) = GL; // OK: through conversion function template
GL_int(3); // OK: same as GL(3)
Date: 2026-07-27.15:54:01
According to 7.5.6 [expr.prim.lambda] paragraph 6, This does not specify whether the conversion function is
noexcept(true) or noexcept(false) . It might be
helpful to nail that down.
The closure type for a non-generic lambda-expression with
no lambda-capture has a public non-virtual non-explicit const
conversion function to pointer to function with C++ language linkage
(9.12 [dcl.link]) having the same parameter and return types as
the closure type's function call operator.
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2017-02-06 00:00:00 | admin | set | status: dr -> cd4 |
| 2015-11-10 00:00:00 | admin | set | messages: + msg6068 |
| 2015-11-10 00:00:00 | admin | set | status: ready -> dr |
| 2015-05-25 00:00:00 | admin | set | messages: + msg5448 |
| 2015-05-25 00:00:00 | admin | set | status: drafting -> ready |
| 2013-10-14 00:00:00 | admin | set | status: open -> drafting |
| 2013-07-31 00:00:00 | admin | create | |