New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix issue 20339 - recalculate isPOD at the end of semantic analysis #10519
Conversation
This issue affects this work too. non POD structs have to be passed by ref for function arguments.
df2888f
to
52d9a8a
Compare
This issue affects this work too. non POD structs have to be passed by ref for function arguments.
Thanks for your pull request and interest in making D better, @SSoulaimane! 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 references
Testing this PR locallyIf you don't have a local development environment setup, you can use Digger to test this PR: dub fetch digger
dub run digger -- build "master + dmd#10519" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, but I'd like another reviewer to also take look.
Please match the pragma message as expected output. |
11b3663
to
cd12293
Compare
This issue affects this work too. non POD structs have to be passed by ref for function arguments.
This issue affects this work too. non POD structs have to be passed by ref for function arguments.
src/dmd/dsymbolsem.d
Outdated
@@ -4751,6 +4751,9 @@ private extern(C++) final class DsymbolSemanticVisitor : Visitor | |||
if (sd.inv) | |||
reinforceInvariant(sd, sc2); | |||
|
|||
// recalculate isPOD | |||
sd.ispod = StructPOD.fwd; | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a bit disturbing, as it suggests that isPOD can return different values for the same struct depending on where in the semantic analysis it is.
The most reliable way to deal with this is to have isPOD fail if semantic analysis has not proceeded far enough to get an accurate answer. Next best would be to have isPOD fail if it produces different results as semantic analysis proceeds. Worst would be to silently produce different results.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It does actually return different results in the test case I provided.
This issue affects this work too. non POD structs have to be passed by ref for function arguments.
4e9d744
to
c615462
Compare
c615462
to
e5fde93
Compare
ccc1565
to
b4a5609
Compare
0325d2d
to
8ff06d4
Compare
…hich affect the result of `isPOD` If `isPOD` is called on a struct in the middle of the semantic analysis of the same srtuct; then pause the semantic analysis of the struct and eagerly process fields, constructors, destructors, and postblits, because they affect the result of `isPOD`, then determine if the struct is a POD and resume semantic analysis of the struct. Sometimes members of a struct rely on the result of isPOD, it happens currently in phobos. `isPOD` is required to know if a function returns on stack, and is sometimes invoked during semantic analysis of a lambda function for `typeof()` or `__traits(compiles)`.
Closing due to inactivity. The original bugzilla report points to this PR in case someone else bumps into the issue and wants to fix it. |
This issue affects ABI with regards to argument passing.