This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of New status.

3655. The INVOKE operation and union types

Section: 22.10.4 [func.require] Status: New Submitter: Jiang An Opened: 2021-12-29 Last modified: 2022-01-15

Priority: 3

View all other issues in [func.require].

View all issues with New status.


There are two cases of the INVOKE operation specified with std::is_base_of_v (22.10.4 [func.require] (1.1), (1,4)), which means the following code snippet is ill-formed, as std::is_base_of_v<B, D> is false when either B or D is a union type.

union Foo { int x; }; 
static_assert(std::is_invocable_v<int Foo::*, Foo&>);

Currently libstdc++ accepts this code, because it uses slightly different conditions that handle union types. libc++ and MSVC STL reject this code as specified in 22.10.4 [func.require].

Should we change the conditions in 22.10.4 [func.require] (1.1) and (1.4) to match libstdc++ and correctly handle union types?

[2022-01-30; Reflector poll]

Set priority to 3 after reflector poll.

Proposed resolution: