-
Notifications
You must be signed in to change notification settings - Fork 4
Description
The == operator is inappropriate for template arguments of a class type with a member of enumeration or pointer-to-member type (and for object pointers would be incompatible with plausible extensions to [temp.arg.nontype]/2; see CWG 2043).
Proposed change:
Approach # 1: Forbid class types with members of such types (to make operator== equivalent to template-argument equivalence).
Approach # 2:
Apply a suitable revision of P1837R0 that reverts not only P0732R2 but also part of P1185R2.
Approach # 3: Define equivalence of class-type non-type template arguments directly in terms of the (template-argument) equivalence of their base class subobjects and non-static data members (which allow to be references, but not mutable or volatile). Remove the definition of strong structural equality; restore from C++17's [temp.param]/4 bullets 1, 2, 4, and 5, or else use "a literal non-class type C for which, given an glvalue...". Directly forbid non-type template parameters of union-like class types.