r/cpp • u/MarkSuckerZerg • 13d ago
Is there a way to track reflection support status in Clang?
(I'm going to be bold and assume the "no questions" rule is for questions about specific code, not about discussing the language itself)
I am extremely happy that we have reflection in C++26, however currently it is GCC only. I am using Clang on all platforms, so I am curious about when it will get reflection.
I tried searching and I found a bunch of experimental forks with reflection. I am not sure if those track the current version of reflection and whether one of these is going to be merged, or if a new implementation will be created. Github issues basically say "we get it when we get it" and link to LLVM discourse. On discourse I found just a thread that a meeting on reflection was held in December.
Do you know either when we are getting reflection, or if there is some way to track its progress for outside observers? Thanks!
12
u/CalamityMetal 13d ago edited 13d ago
If you wanna track which compiler has which feature, cppreference has a compiler support page, there's also cppstat.dev, but if you're wondering about the development status of said features, you can look at the public repos I suppose of those various compiler teams, like LLVM and GNU.
12
u/TryingT0Wr1t3 13d ago
If you are looking for Apple Clang, comeback in three years.
11
u/Henrarzz 13d ago
Three? They still don’t have modules implemented
18
9
u/ABlockInTheChain 13d ago
Neither upstream libc++ nor the Apple fork of it have completely implemented C++17 yet.
0
u/pjmlp 13d ago
They have the original clang header modules implementation, that works great with Objective-C and Swift modules, and C++ interop, which is what Apple mainly cares about.
Note that Metal Shading Language is still based on C++14, while IO Kit and DriverKit are largely inspired on the old Embedded C++ design.
I advise watching the session Meet with Apple for secure software, in regards to where they stand for using C or C++ in new applications.
0
u/dokpaw 13d ago
They have. It's just a buggy older implementation. Try with the -fmodules and -fcxx-modules switches.
2
u/Henrarzz 13d ago
Are you sure about AppleClang? Because I just checked in Xcode and it doesn’t work
2
5
u/PhantomStar69420 13d ago
Use gcc its a waaay better experience even on windows.
3
u/MarkSuckerZerg 13d ago
Well I'm tempted to try it, but I dont know if clang reflection will be merged tomorrow ;)
3
u/EdwinYZW 13d ago
I'm also trying to find out what progress they are making. My projects are running with both gcc and clang in CI as some errors can be caught by one compiler but not the other. I could disable all clang-related CIs for a short time to use gcc reflection if clang is going to implement it in a few months. If not, I think it's better to wait until clang implements it.
Clangd, clang-tidy and clang-format are also problems if I just go with gcc reflection.
2
u/Ok_Bite_67 11d ago
I was going to get back into cpp because of their new reflection features just to discover that you still have to instantiate stuff before its called. Immediately went back and completely uninstalled everything related to cpp. Its been around 14 years since I have touched the language and it seems like all they focus on is stupid headline features and not the core functionality of the language (yeah, yeah I get the committee that creates the standard has no input on cpp having a single pass compiler, but that disorganization still makes the language worse than nearly any other language on the face of this planet).
43
u/erichkeane Clang Maintainer(Templates), EWG Chair 13d ago
There is a biweekly Reflection Upstreaming meeting on the LLVM calendar that we do to go over the progress. There are a few devs working on trying to fixup the original implementations to make them acceptable, and quite a few maintainers are in those meetings (myself excluded).
I don't have a good feel on WHEN, as it is mostly volunteer labor of course, so we're dependent on their availability.