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.

3240. Headers declare more than entities

Section: 16.4.3.2 [using.headers] Status: New Submitter: Alisdair Meredith Opened: 2019-07-24 Last modified: 2020-04-07

Priority: 3

View all other issues in [using.headers].

View all issues with New status.

Discussion:

Quoting 16.4.3.2 [using.headers] p3:

"[…] and shall include the header lexically before the first reference in that translation unit to any of the entities declared in that header."

This suggests we may be able to use macros and typedefs (like size_t) declared in standard headers without the corresponding #include. Clearly that is not the intended behavior!

I thought about replacing 'entity' with 'name', but the same name may occur with different contexts throughout the standard library. I thought about "contents of that header", but run afoul of the same function overloads (std::begin etc.) being declared in multiple headers.

It may be simpler to turn this sentence around, along the lines of:

"No part of the standard library shall be used in a translation unit prior to a including or importing a header that provides that feature."

Even here, 'used' may be a problematic term of art. Perhaps "named"?

[2020-04-07 Issue Prioritization]

Priority to 3 after reflector discussion.

Proposed resolution: