Closed rajkosto closed 1 year ago
Wow, this is a weird bug for Visual Studio. But, Visual Studio also has a lot of C++20 compile time programming bugs. I'm hoping that they make progress soon. I've submitted some associated ones in the past that are probably related. I might try to play around with VS to find a workaround, but I really am hoping they will fix things.
I'm kind of busy right now but here are some thoughts.
Could just be that the debug symbols are getting too long.
If not then I know join has had multiple issues on msvc due to using lvalue reference non type template parameters which has always seemed to have buggy support on msvc. I think the prior workaround for msvc never produced the invalid or corrupt file: duplicate COMDAT
but I have seen that error pop up once after implemented a workaround that supported both msvc2022 and msvc2019. I didn't think this was still an issue but looks like there are ways to still trigger it. We could just go back to using separate workarounds for each msvc version. Or we could just use literal class non-type template parameters which are better supported.
the debug symbols are definitely not too long its some problem with their incremental linking that is enabled in Debug, as I said in the bug report, it works if i change one of the strings to something else, build, then change it back and build again (so its not a full rebuild from scratch with the duplicate string literals) i remember having similar problems with static inline constexpr arrays inside templates before, slightly modifying the handling code for that made it work properly
Should be addressed in #284.
I think you are correct that its related to the incremental linker since I was able to get rid of it by using some flags like /INCREMENTAL:NO.
However, ideally we wouldn't want to force the usage of special flags so I played around with the join code until your project stopped generating link errors.
Fantastic, this fixed it in all my projects in Visual Studio 2019 as well!
Reproduction project: https://github.com/rajkosto/glazetest (very simple struct to json of 2 different structs with same member name)
I've created a VS bug report but who knows if it will be fixed (and likely won't be fixed in VS2019 that I use anyway) here: https://developercommunity.visualstudio.com/t/Using-C20-library-glaze-and-doing-full/10352112?
Any workarounds that you can think of ?