Skip to content
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

Issue 4500 - scoped moves class after calling the constructor #148

Merged
merged 1 commit into from
Aug 14, 2011

Conversation

9rnsr
Copy link
Contributor

@9rnsr 9rnsr commented Jul 17, 2011

By fixing issue 5777, now we can fix issue 4500.

@ckamm
Copy link

ckamm commented Jul 17, 2011

I've tried it and can verify the two changes make scoped work correctly. I've two unrelated questions:

  • Why is there a special case for the no-argument constructor? Shouldn't emplace work for that as well?
  • I couldn't break the alignment of the Scoped struct even though typeof(scoped!Someclass()).alignof == 1. How does the code ensure correct alignment?

@9rnsr
Copy link
Contributor Author

9rnsr commented Jul 17, 2011

Why is there a special case for the no-argument constructor? Shouldn't emplace work for that as well?

Maybe it is true, but I didn't touch code that is not related to 4500.

I couldn't break the alignment of the Scoped struct even though typeof(scoped!Someclass()).alignof == 1. How does the code ensure correct alignment?

I don't know how to do it.Does current D have the way that set struct object alignment?

class C{}
struct S{}
align(4) struct S2{}
pragma(msg, C.alignof);  // print 4u
pragma(msg, S.alignof);  // print 1u
pragma(msg, S2.alignof);  // still print 1u

@ckamm
Copy link

ckamm commented Jul 17, 2011

Maybe it is true, but I didn't touch code that is not related to 4500.

Sure, I was just wondering.

I don't know how to do it.Does current D have the way that set struct object alignment?

The align attribute only changes the alignment rules of members of the struct, not the alignment of the struct itself. As far as I know the only way would be something like this:

struct S { union { ulong a; // for alignment ubyte data[instanceSize]; } }

andralex added a commit that referenced this pull request Aug 14, 2011
Issue 4500 - scoped moves class after calling the constructor
@andralex andralex merged commit f122aeb into dlang:master Aug 14, 2011
kuettler pushed a commit to kuettler/phobos that referenced this pull request Feb 6, 2018
rdmd: Fix std.process.getenv deprecation warning
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants