This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 119a. See http://www.open-std.org/jtc1/sc22/wg21/ for the official list.
2025-12-20
[Adopted at the November, 2016 meeting as part of paper P0003R5.]
Consider the following example:
struct B { virtual void f() { } }; struct D : B { } d; bool b = noexcept(typeid(d));According to 7.6.2.7 [expr.unary.noexcept] paragraph 3, the value ofb should befalse, because 14.5 [except.spec]bullet 14.6 says,
Ife is atypeid expression applied to a glvalueexpression whose type is a polymorphic class type(7.6.1.8 [expr.typeid]),S consists of the typestd::bad_typeid.
andd is such an expression. This is clearly bogus, as theexpression cannot possibly throw; according to 7.6.1.8 [expr.typeid] paragraph 2, the condition under which the exception might be thrownis:
If the glvalue expression is obtained by applying the unary*operator to a pointer69 and the pointer is a null pointer value(7.3.12 [conv.ptr]), thetypeid expression throws an exception(14.2 [except.throw]) of a type that would match a handler of typestd::bad_typeid exception (17.7.5 [bad.typeid]).
Proposed resolution (November, 2016):
Change 14.5 [except.spec] bullet 13.6 as follows:
Theset of potential exceptions of an expressione is empty ife is a core constant expression(7.7 [expr.const]). Otherwise, it is the union of the sets ofpotential exceptions of the immediate subexpressions ofe,including default argument expressions used in a function call, combinedwith a setS defined by the form ofe, as follows:
...
Ife is atypeid expression applied toa
glvalue expression whose type is(possibly parenthesized)built-in unary* operator applied to a pointer to apolymorphic class type (7.6.1.8 [expr.typeid]),S consists ofthe typestd::bad_typeid. [Example: ...