Title
Headers declare more than entities
Status
new
Section
[using.headers]
Submitter
Alisdair Meredith

Created on 2019-07-24.00:00:00 last changed 57 months ago

Messages

Date: 2020-04-07.00:00:00

[ 2020-04-07 Issue Prioritization ]

Priority to 3 after reflector discussion.

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

History
Date User Action Args
2020-04-07 12:59:33adminsetmessages: + msg11204
2019-07-24 00:00:00admincreate