Created on 2025-08-28.00:00:00 last changed 3 days ago
Suggested resolution:
Add a new bullet after 7.7 [expr.const] bullet 10.22 as follows:
- ...
- a construction of an exception object, unless the exception object and all of its implicit copies created by invocations of std::current_exception or std::rethrow_exception (17.9.7 [propagation]) are destroyed within the evaluation of E;
- a throw-expression (7.6.18 [expr.throw]) with no operand, unless there is a currently handled exception whose exception object was constructed within the evaluation of E;
- ...
(From submission #756.)
Consider:
int main() {
try {
throw 0;
} catch (...) {
constexpr int x = [] {
try {
throw; // #1
} catch (...)
return 1;
}
}();
}
}
According to 7.6.18 [expr.throw] paragraph 3, #1 rethrows the currently handled exception as defined in 14.4 [except.handle] paragraph 10, which would rethrow the runtime exception inside a constant expression.
History | |||
---|---|---|---|
Date | User | Action | Args |
2025-09-10 19:05:09 | admin | set | messages: + msg8085 |
2025-08-28 00:00:00 | admin | create |