This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 118c. See http://www.open-std.org/jtc1/sc22/wg21/ for the official list.

2025-10-11


3075. Unclear matching of import directive

Section: 15.6  [cpp.import]     Status: tentatively ready     Submitter: Hubert Tong     Date: 2025-09-22

(From submission #767.)

Subclause 15.6 [cpp.import] paragraph 2 is unclear whether the matching of the last form happens before or after macro replacement.

Proposed resolution (approved by CWG 2025-09-26):

Change in 15.6 [cpp.import] paragraph 2 as follows:

The preprocessing tokens after the import preprocessing token in the import control-line are processed just as in normal text (i.e., each identifier currently defined as a macro name is replaced by its replacement list of preprocessing tokens). [Note 1: An import directive matching the first two forms of a pp-import instructs the preprocessor to import macros from the header unit (10.3 [module.import]) denoted by the header-name, as described below. —end note] The point of macro import for the first two forms of pp-import is immediately after the new-line terminating the pp-import. The last form of pp-import does not have a point of macro import, and is only considered if, after macro replacement, the first two forms did not match, and does not have a point of macro import.