1044. Empty tag types should be constexpr literals

Section: 32.6 [thread.mutex] Status: C++11 Submitter: Alisdair Meredith Opened: 2009-03-12 Last modified: 2016-01-28

Priority: Not Prioritized

View all other issues in [thread.mutex].

View all issues with C++11 status.

Discussion:

Addresses UK 325 [CD1]

We believe constexpr literal values should be a more natural expression of empty tag types than extern objects as it should improve the compiler's ability to optimize the empty object away completely.

[ Summit: ]

Move to review. The current specification is a "hack", and the proposed specification is a better "hack".

[ Batavia (2009-05): ]

We agree with the proposed resolution. Move to Tentatively Ready.

Proposed resolution:

Change the synopsis in 32.6 [thread.mutex]:

struct defer_lock_t {};
struct try_to_lock_t {};
struct adopt_lock_t {};

extern constexpr defer_lock_t defer_lock {};
extern constexpr try_to_lock_t try_to_lock {};
extern constexpr adopt_lock_t adopt_lock {};