Logo

Blog


C++ Insights now uses Clang 16

On Monday, I finally managed to switch C++ Insights to Clang 16!

Yes, I'm very, very late with Clang 16 support, given that a few days ago, Clang 17 was released. As far as I can remember, the change from Clang 15 to 16 was the toughest so far.

Namespaces

The biggest issue was that Clang changed the handling of namespaces. This did break a lot of test cases, and it still does. I decided to go with it anyway because the effort to fix the remaining issues is very high compared to and potentially not worth the effort.

Other issues

While the namespace change was the hardest, it was complicated because, as always, Clang also changed a couple of internal functions and their behavior.

libc++ experimental library support

Another challenge I faced was dealing with experimental library support in libcxx. This Discourse thread discusses introducing this flag. The essence of this flag and the idea behind it is that the maintainers can ship library implementations that aren't complete and where the ABI or API might change. That way, the implementers can protect us users from accidentally using a certain library element, and at the same time, they can ship the library as part of an official Clang release, which means they can have feedback from testers. I like this idea. However, for C++ Insights, I have the issue that with Clang 16, they guard std::format behind this flag. Since C++ Insights doesn't produce a binary you can ship to your customers, I figured that experimental support cannot hurt that much (let's see how right I am about that). C++ Insights internally set the -fexperimental-library flag, meaning you can use Clang's std::format implementation now.

Support the project

You can support the project by becoming a GitHub Sponsor or, of course, contribute with code.

Andreas