You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In [headers] (technically library wording), we have
Each element of the C++ standard library is declared or defined (as appropriate) in a header (A header is not necessarily a source file)
Presumably, the intent here is to permit an implementation to make a set of declaration available when incanting #include <vector> through magic rather than by following steps 1-4 of translations
However, both [cpp.include] and [lex.phases] seem to apply to "headers" and seem to contradict the note in [headers]
A #include preprocessing directive causes the named header or source file to be processed from phase 1 through phase 4, recursively.
In [cpp.include], we also say "If the *header identified by the denotes an importable header [...]", and here "header" need not be a standard library header (as there can be non-standard importable headers).
We have talked about the lack of clarity in this area before, but I could not find an issue for it.
I think a solution would be on the lines of
Any source file whose content was included to the current processing unit through an #include directive is a header
Both source files and headers behave the same through phases 1-4
In [headers], rename header to standard library header
We should remove the possibility that standard library headers are not source files as I'm not aware of anyone using that capability, nor can i imagine anyone wanting to ever do something like that.
The text was updated successfully, but these errors were encountered:
IMO there's no actual defect here. But it seems to me that the suggestions can simplify and clarify the wording without changing normative requirements.
An implementation may use a Pre-Compiled Header (.pch file) when a header is requested. However, name lookup requires the point of declaration to be well-defined, which requires the declaration to exist as-if in a source file.
An implementation may use a Pre-Compiled Header (.pch file) when a header is requested.
Per [lex.phase] p1.1, IIUC, we can treat decoding PCH as an implementation-defined manner of mapping characters from the input file. So it's perhaps meaningless to allow a header not to be a source file.
In
[headers]
(technically library wording), we havePresumably, the intent here is to permit an implementation to make a set of declaration available when incanting
#include <vector>
through magic rather than by following steps 1-4 of translationsHowever, both [cpp.include] and [lex.phases] seem to apply to "headers" and seem to contradict the note in
[headers]
In
[cpp.include]
, we also say "If the *header identified by the denotes an importable header [...]", and here "header" need not be a standard library header (as there can be non-standard importable headers).We have talked about the lack of clarity in this area before, but I could not find an issue for it.
I think a solution would be on the lines of
#include
directive is a header[headers]
, rename header to standard library headerThe text was updated successfully, but these errors were encountered: