Repository navigation
[internal/traits] Fix regression in hasElaborateDestructor - #22554
Conversation
|
Thanks for your pull request and interest in making D better, @ntrel! 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#22554" |
| // enum hasElaborateDestructor = __traits(hasMember, S, "__xdtor"); | ||
|
|
||
| enum hasElaborateDestructor = hasDtor([__traits(allMembers, S)]); | ||
| enum hasElaborateDestructor = __traits(compiles, (S s) => (cast() s).__xdtor); |
There was a problem hiding this comment.
This is certainly a more clever fix than I was thinking of doing. Of course, it really should be the solution with hasMember, but the compiler seems incapable of dealing with __xdtor properly with either hasMember or allMembers at the moment. :|
There was a problem hiding this comment.
This has the side effect of instantiating opDispatch speculatively, which is likely why b6400 fails...
There was a problem hiding this comment.
That was the problem, thanks!
|
It looks like the failures are unrelated, though there are enough of them that it's possible that one of them is related, since I didn't dig through all of them. |
|
dmd's |
|
It looks like this caused a different regression: #22609 |
|
It might be cleaner to add a new builtin trait for this - we already have Lines 577 to 599 in 03bf6f0 |
Fixes dlang/phobos#10950.
I had to use
version (CoreUnittest)to test the fix because it is dependent on the order of declarations. So it can't use aunitest {}.