-
Notifications
You must be signed in to change notification settings - Fork 263
Description
Describe the bug
As the title describe, MSVC 19 doesn't optimize out the UFCS macros. It seems to be a serious problem since the UFCS lambdas generate a fair bit of code and end up generated for every function call. Both GCC & Clang optimize them out even at the lowest optimization level (-Og).
This is not a bug in cppfront per say, but it is still a bug that will affect it directly imo - and maybe something that cppfront can work around. It is not clear where it should be fixed ultimately.
To Reproduce
https://godbolt.org/z/ravPdfjoG
Additional context
I was playing with the UFCS macros in regular C++ code and I wanted to see whether the lambdas got removed in debug builds, put them in godbolt, no compilers get rid of them with -O0 - which is understandable. GCC & Clang get rid of them at any optimization level I tried (-Og, -Os, -O1, -O2) but MSVC doesnt even get rid of them in any optimization level (neither /O2 nor /O3 - although I dont recall whether that's a legit level for MSVC or if it just gets pegged back to /O2).