C++ Insights now uses Clang 12

Today I finally managed to switch C++ Insights to Clang 12!

As I suspected, it was not that fun. Aside from the usual changes due to standard upgrades, I hit a couple of unexpected issues.

Clang changes

Issue181.cpp no longer compiles with Clang 12. To be fair, it looks like it never compiled with any other compiler. However, I still have to track down whether this is a regression in Clang or not.

In the same bucket falls the next issue. On Windows an implicit conversion stopped working (InsightsHelpers.cpp).

Two ways, two answers

A more interesting case was NonTypeTemplateArgTest.cpp . Here, Clang 12 revealed a shortcoming of the current implementation of how C++ Insights gets the type information. If you run the code in C++ Insights (to the code) , then you can see that in the output in line 31, the type of the variable is different from the one of the constructor. Guess what, if you implement two ways of retrieving the same information, you end up with two different results. While I have a fix for this scenario, the impact is bigger. If you, for example, transform code with a std::string variable in it, you see the type std::string for the variable and basic_string for the initializer. This is the same issue, just that it usually compiles.

I plan to add an option switching between the modes. My goal was to first upgrade to Clang 12 and then fix this issue. It requires adding an option to the web frontend as well. Once I find time in the next days, I will tackle this.


The most disappointing issue I hit was the code coverage under macOS. It looks like Clang 12 changed the cov-format, and gcov no longer understands it properly. I'm still investigating this one as I wasn't able to come up with a fix in a short time.

Regardless of all the issues, you can now use C++ Insights together with Clang 12. Enjoy it, and let me know if you find any issues.

I also plan to upgrade gcc-10 to gcc-11 to get the latest libstc++ version.

Support the project

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