[Issue 3449] const and invariant struct members do not behave according to spec
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Tue Sep 21 04:44:16 PDT 2010
http://d.puremagic.com/issues/show_bug.cgi?id=3449
Lars T. Kyllingstad <bugzilla at kyllingen.net> changed:
What |Removed |Added
----------------------------------------------------------------------------
Severity|normal |major
--- Comment #4 from Lars T. Kyllingstad <bugzilla at kyllingen.net> 2010-09-21 04:43:38 PDT ---
More strangeness: If you don't explicitly provide an initial value for
const/immutable members, they do contribute to the size of the struct.
struct Foo { const int i; }
writeln(Foo.sizeof); // Prints 4
struct Bar { const int i = 123; }
writeln(Bar.sizeof); // Prints 1
I suspect that this bug could cause unexpected memory corruption when such
structs are, for instance, passed to C functions -- especially when the
behaviour depends on such a small detail.
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list