On Fri, May 26, 2023 at 1:44 PM Jens Maurer <jens.maurer@gmx.net> wrote:

On 26/05/2023 11.23, Mathias Stearn wrote:
> Perhaps we mostly disagree on the framing though. My take is that the problem here _isn't_ that foo.h was declared as importable. The problem is that qux.h is trying to change the meaning of the foo.h header.

That's a fine interpretation from my point of view.

CWG2732 will clarify that any macros that happen to be active at the
point of import have no bearing on the contents of an importable header:

Given the note in http://eel.is/c++draft/cpp.import#5 applying to the definition of the term "macro definition", we should probably change the CWG2732 note to say something like "macro definitions and predefined macros". While -D predefined macros are somewhat outside the scope of the standard, and the standard has no concept of a build using different values for the standardized predefined macros for different TUs (which is unfortunately common practice),  I think we should be clear (in a note) that the predefined macros used for a header unit are those used when compiling *its* TU, not the importer's.
That still allows to set -DDEBUG in your user-defined "list of
importable headers" for this particular header (or more globally),
if you so feel.