May 18, 2010 [Issue 4203] New: Const field of struct that contains a whole struct | ||||
---|---|---|---|---|
| ||||
http://d.puremagic.com/issues/show_bug.cgi?id=4203 Summary: Const field of struct that contains a whole struct Product: D Version: future Platform: x86 OS/Version: Windows Status: NEW Severity: normal Priority: P2 Component: DMD AssignedTo: nobody@puremagic.com ReportedBy: bearophile_hugs@eml.cc --- Comment #0 from bearophile_hugs@eml.cc 2010-05-18 04:08:11 PDT --- I don't understand what's going on here, but even if this is not a bug (and to me it looks like a problem) it's too much tricky for D newbies. This runs with dmd v2.046: // case 1 struct Foo { const Foo f = Foo(); } static assert(Foo.sizeof == 1); void main() {} While this is not OK: // case 2 struct Foo { const Foo f; } static assert(Foo.sizeof == 1); void main() {} dmd v2.046 prints: test.d(2): Error: struct test.Foo cannot have field f with same struct type test.d(2): Error: struct test.Foo cannot have field f with same struct type -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
December 26, 2012 [Issue 4203] Const field of struct that contains a whole struct | ||||
---|---|---|---|---|
| ||||
Posted in reply to bearophile_hugs@eml.cc | http://d.puremagic.com/issues/show_bug.cgi?id=4203 Andrej Mitrovic <andrej.mitrovich@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED CC| |andrej.mitrovich@gmail.com Resolution| |DUPLICATE --- Comment #1 from Andrej Mitrovic <andrej.mitrovich@gmail.com> 2012-12-26 14:27:45 PST --- This is caused by Issue 3449. The problem is when an initializer is present 'f' becomes a manifest constant. Walter agreed it has to be fixed, but we have to wait for https://github.com/D-Programming-Language/dmd/pull/93 to be merged. *** This issue has been marked as a duplicate of issue 3449 *** -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
Copyright © 1999-2021 by the D Language Foundation