digitalmars.D.bugs - [Issue 9904] New: typeof(null) can be casted to aggregate type if .sizeof equals size of pointer
- d-bugmail puremagic.com (34/34) Apr 08 2013 http://d.puremagic.com/issues/show_bug.cgi?id=9904
- d-bugmail puremagic.com (7/27) Apr 08 2013 http://d.puremagic.com/issues/show_bug.cgi?id=9904
- d-bugmail puremagic.com (11/23) Apr 08 2013 http://d.puremagic.com/issues/show_bug.cgi?id=9904
- d-bugmail puremagic.com (20/36) Apr 08 2013 http://d.puremagic.com/issues/show_bug.cgi?id=9904
- d-bugmail puremagic.com (13/13) Jun 07 2013 http://d.puremagic.com/issues/show_bug.cgi?id=9904
- d-bugmail puremagic.com (13/13) Jun 07 2013 http://d.puremagic.com/issues/show_bug.cgi?id=9904
http://d.puremagic.com/issues/show_bug.cgi?id=9904 Summary: typeof(null) can be casted to aggregate type if .sizeof equals size of pointer Product: D Version: D2 Platform: All OS/Version: All Status: NEW Keywords: accepts-invalid Severity: normal Priority: P2 Component: DMD AssignedTo: nobody puremagic.com ReportedBy: andrej.mitrovich gmail.com 07:42:22 PDT --- struct S1 { int x; } struct S2 { int x; byte b; } void main() { static assert(S1.sizeof == typeof(null).sizeof); auto s1 = cast(S1)null; // compiles, should not static assert(S2.sizeof != typeof(null).sizeof); auto s2 = cast(S2)null; // NG, as it should } -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Apr 08 2013
http://d.puremagic.com/issues/show_bug.cgi?id=9904 07:47:34 PDT ---struct S1 { int x; } struct S2 { int x; byte b; }Those should really use size_t to reproduce on all systems:struct S1 { size_t x; } struct S2 { size_t x; byte b; }-- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Apr 08 2013
http://d.puremagic.com/issues/show_bug.cgi?id=9904 bearophile_hugs eml.cc changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |bearophile_hugs eml.ccThose should really use size_t to reproduce on all systems:Why is that cast a problem/bug? Maybe there is no compiler bug here. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------struct S1 { size_t x; } struct S2 { size_t x; byte b; }
Apr 08 2013
http://d.puremagic.com/issues/show_bug.cgi?id=9904 10:31:56 PDT ---It may not do what the user expects. For example they might think this is a good way to initialize the struct to its default value, but it's wrong: import std.math; struct S { float x; } void main() { auto s1 = S.init; auto s2 = cast(S)null; assert(isnan(s1.x)); assert(isnan(s2.x)); // fails } -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------Those should really use size_t to reproduce on all systems:Why is that cast a problem/bug? Maybe there is no compiler bug here.struct S1 { size_t x; } struct S2 { size_t x; byte b; }
Apr 08 2013
http://d.puremagic.com/issues/show_bug.cgi?id=9904 Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/d859a617045bdf04b39edf14bb782faff642141a fix issue 9904 - typeof(null) can be casted to aggregate type if .sizeof equals size of pointer https://github.com/D-Programming-Language/dmd/commit/3c5eb896fb87b788dd0cb7631fbdf8c5cf77d9f2 fix issue 9904 - typeof(null) can be casted to aggregate type if .sizeof equals size of pointer -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jun 07 2013
http://d.puremagic.com/issues/show_bug.cgi?id=9904 Kenji Hara <k.hara.pg gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |pull Status|NEW |RESOLVED Resolution| |FIXED Merged pull request: https://github.com/D-Programming-Language/dmd/pull/2148 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jun 07 2013