This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 118c. See http://www.open-std.org/jtc1/sc22/wg21/ for the official list.
2025-10-11
Per the specification, the block scope for a function-try-block does not include the ctor-initializer. Consider the following implementation divergence:
struct A {
A() try : p((struct B*)nullptr) {
B *q;
struct B {};
B *r = q; // EDG, GCC, MSVC: error: cannot convert, two different Bs
} catch (...) {
B *q; // GCC: B not in scope here.
}
void *p;
};
struct C {
C(int B) try : p((struct B*)0) { // GCC: error: shadows parameter; MSVC: error: redefinition of B
} catch (...) { }
void *p;
};
There is also implementation divergence regarding the scope of the ctor-initializer if no function-try-blocks are involved.