
On Mon, 13 Jan 2025 at 20:37, Peter Dimov
Ruben Perez wrote:
I think this applies for non module units, too. I've just tested that, under MSVC, the following errors:
// File: main.cpp import std; #include <cstddef> int main() {}
This does not seem to happen with all the headers, though. * version, cstdint, climits, cassert, cfloat, cstdio, cstdlib, cerrno seem to work fine * cmath and cstddef seem to error.
So if we have in a program:
// File: main.cpp #include
#include int main() {} Yeah, that's going to be a problem.
Interestingly, though,
import std; #include
#include int main() {} works fine.
If we only need these for the macros, this might well work.
(It's probably std::byte from cstddef that breaks things.)
I think it has to do with where entities are declared. Your snippet
errors if you import std.compat (which can safely be avoided
altogether in all our code without problems):
import std.compat;
#include