Fix FUNCFLAG with SCOPE bitmask error#16752
Conversation
|
Thanks for your pull request and interest in making D better, @dkorpel! We are looking forward to reviewing it, and you should be hearing from a maintainer soon.
Please see CONTRIBUTING.md for more information. If you have addressed all reviews or aren't sure how to proceed, don't hesitate to ping us with a simple comment. Bugzilla referencesYour PR doesn't reference any Bugzilla issue. If your PR contains non-trivial changes, please reference a Bugzilla issue or create a manual changelog. Testing this PR locallyIf you don't have a local development environment setup, you can use Digger to test this PR: dub run digger -- build "master + dmd#16752" |
|
If D had bitfields, and dmd used them for bit flags, this error wouldn't have happened. |
|
Wow... just wow. |
|
I call it an honest mistake and have to agree with @WalterBright here. |
There are more direct causes: Also, whether D has built-in bitfields and whether DMD uses typesafe flags are orthogonal questions. |
It's a good thing D already has bitfields then. Now we just need to make dmd use them! |
What the?! 🤨
So in #14846, an extra check was added related to the enclosing function of
__traits(compiles):However,
sc.func.flagsis not of typeSCOPE, it'sFUNCFLAGS.SCOPE.compileis0x100and by sheer coincidence, it just happened to line up withFUNCFLAG.isCompileTimeOnly.That flag was introduced in #7897, and there seems no reason why it should have the same mask as
SCOPE.compile.Then, when the
isCompileTimeOnlyflag was removed in #14847, it lined up with the equivalentFUNCFLAG.skipCodegen. Only when I tried to remove a flag before it in #16751 did I notice very confusing breakage in__traits(compiles).There's barely any use for the
FuncDeclaration.flagsproperty anymore, so I renamed it to avoid future confusion.@RazvanN7 since you wrote the code, can you verify whether it indeed was magically correct all along?