Skip to content

US114 13.05 p1.5 Class types as non-type template arguments #113

@wg21bot

Description

@wg21bot

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.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions