352. missing fpos requirements

Section: 24.2.2 [char.traits.typedefs] Status: CD1 Submitter: Martin Sebor Opened: 2001-12-02 Last modified: 2016-02-10

Priority: Not Prioritized

View all other issues in [char.traits.typedefs].

View all issues with CD1 status.

Discussion:

(1) There are no requirements on the stateT template parameter of fpos listed in 27.4.3. The interface appears to require that the type be at least Assignable and CopyConstructible (27.4.3.1, p1), and I think also DefaultConstructible (to implement the operations in Table 88).

21.1.2, p3, however, only requires that char_traits<charT>::state_type meet the requirements of CopyConstructible types.

(2) Additionally, the stateT template argument has no corresponding typedef in fpos which might make it difficult to use in generic code.

Proposed resolution:

Modify 21.1.2, p4 from

Requires: state_type shall meet the requirements of CopyConstructible types (20.1.3).

Requires: state_type shall meet the requirements of Assignable (23.1, p4), CopyConstructible (20.1.3), and DefaultConstructible (20.1.4) types.

Rationale:

The LWG feels this is two issues, as indicated above. The first is a defect---std::basic_fstream is unimplementable without these additional requirements---and the proposed resolution fixes it. The second is questionable; who would use that typedef? The class template fpos is used only in a very few places, all of which know the state type already. Unless motivation is provided, the second should be considered NAD.