Headers declare more than entities
Alisdair Meredith

Created on 2019-07-24.00:00:00, last changed 2019-07-24.00:00:00.


Date: 2019-07-24.00:00:00

Quoting [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"?

Date User Action Args
2019-07-24 00:00:00admincreate