r/cpp • • Jun 18 '26

GCC 17 Lands Initial Infrastructure For C++29

https://www.phoronix.com/news/GCC-17-std-CPP29-Experimental
130 Upvotes

38 comments sorted by

View all comments

Show parent comment

5

u/not_a_novel_account cmake dev Jun 18 '26

I think it should be possible to not leak _IDL stuff into the module initializer, that's what goes in std.obj.

Everyone else this is an empty initializer, with the exception of libstdc++ on MacOS which actually does have some global state they initialize.

It's purely bookkeeping for libc++, as the initializer is completely empty for them on all platforms.

I haven't torn into exactly what global state the STL is trying to initialize here beyond "std::print() will fail without it", something to look into on a long weekend.

3

u/Expert-Map-1126 vcpkg maintainer BillyONeal Jun 18 '26

I was under the impression that that .obj would also contain non-dependent inline functions which might have `std::string` in their interfaces, which depends on `_IDL`.

3

u/not_a_novel_account cmake dev Jun 18 '26 edited Jun 18 '26

Those get serialized into the BMI, call sites incorporate them into their own object files as COMDAT/vague-linkage symbols, same as headers.

The only reason module interfaces must always produce object files is dynamic initialization of statics, because the standard says that module interfaces are translation units ([basic.link]), and the statics from those TUs are initialized in interface dependency order ([basic.start.dynamic]).

Now I'm overstating the case because don't know if the first sentence is true for MSVC's implementation, but it's true for LLVM and GCC, and the IFC spec seems to imply it's the case for MSVC.