Created on 2022-12-13.00:00:00 last changed 4 months ago
Proposed resolution (approved by CWG 2024-03-20):
Insert a new paragraph before 6.3 [basic.def.odr] paragraph 11:
[ Example:
void g() { constexpr int x = 1; auto lambda = [] <typename T, int = ((T)x, 0)> {}; // OK lambda.operator()<int, 1>(); // OK, does not consider x at all lambda.operator()<int>(); // OK, does not odr-use x lambda.operator()<const int&>(); // error: odr-uses x from a context where x is not odr-usable } void h() { constexpr int x = 1; auto lambda = [] <typename T> { (T)x; }; // OK lambda.operator()<int>(); // OK, does not odr-use x lambda.operator()<void>(); // OK, does not odr-use x lambda.operator()<const int&>(); // error: odr-uses x from a context where x is not odr-usable }-- end example ]
Every program shall contain at least one definition of every function or variable ...
[Accepted as a DR at the March, 2024 meeting.]
Default template arguments of generic lambdas can refer to local variables. It is unclear whether the potential odr-use is checked when parsing the template definition or when instantiating the template.
There is wide implementation divergence.
History | |||
---|---|---|---|
Date | User | Action | Args |
2024-07-20 13:52:34 | admin | set | status: dr -> drwp |
2024-04-05 21:43:46 | admin | set | status: ready -> dr |
2024-03-20 03:04:54 | admin | set | status: tentatively ready -> ready |
2024-03-03 21:57:08 | admin | set | messages: + msg7627 |
2024-03-03 21:57:08 | admin | set | status: open -> tentatively ready |
2022-12-13 00:00:00 | admin | create |