digitalmars.D.bugs - [Issue 9162] New: [tdpl] Non-static structs should have access to outer lexical scope
- d-bugmail puremagic.com (36/36) Dec 15 2012 http://d.puremagic.com/issues/show_bug.cgi?id=9162
- d-bugmail puremagic.com (9/9) Dec 15 2012 http://d.puremagic.com/issues/show_bug.cgi?id=9162
- d-bugmail puremagic.com (24/24) Dec 15 2012 http://d.puremagic.com/issues/show_bug.cgi?id=9162
- d-bugmail puremagic.com (8/8) Dec 15 2012 http://d.puremagic.com/issues/show_bug.cgi?id=9162
- d-bugmail puremagic.com (7/10) Dec 16 2012 http://d.puremagic.com/issues/show_bug.cgi?id=9162
- d-bugmail puremagic.com (10/10) Dec 16 2012 http://d.puremagic.com/issues/show_bug.cgi?id=9162
- d-bugmail puremagic.com (9/9) Dec 17 2012 http://d.puremagic.com/issues/show_bug.cgi?id=9162
http://d.puremagic.com/issues/show_bug.cgi?id=9162 Summary: [tdpl] Non-static structs should have access to outer lexical scope Product: D Version: D2 Platform: All OS/Version: All Status: NEW Severity: normal Priority: P2 Component: DMD AssignedTo: nobody puremagic.com ReportedBy: hsteoh quickfur.ath.cx --- Comment #0 from hsteoh quickfur.ath.cx 2012-12-15 11:40:31 PST --- The following is adapted from Walter's "Voldemort Types" article: import std.stdio; auto makeVoldemort(int x) { struct Voldemort { property int value() { return x; } // Compile error: } return Voldemort(); } void main() { auto v = makeVoldemort(123); writeln(v.value); } Compiler output: test.d(5): Error: function test.makeVoldemort.Voldemort.value cannot access frame of function test.makeVoldemort According to TDPL, §7.1.9 (p.263): <quote>Nested structs embed the magic "frame pointer" that allows them to access outer values such as a and b in the example above."</quote> -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Dec 15 2012
http://d.puremagic.com/issues/show_bug.cgi?id=9162 --- Comment #1 from hsteoh quickfur.ath.cx 2012-12-15 11:48:42 PST --- Also from that paragraph in TDPL: "If you want to define a nested struct without that baggage, just prefix struct with static in the definition of Local, which makes Local a regular struct and consequently prevents it from accessing a and b." -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Dec 15 2012
http://d.puremagic.com/issues/show_bug.cgi?id=9162 Walter Bright <bugzilla digitalmars.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |bugzilla digitalmars.com --- Comment #2 from Walter Bright <bugzilla digitalmars.com> 2012-12-15 14:51:29 PST --- This fails: auto makeVoldemort(int x) { struct Voldemort { property int value() { return x; } } return Voldemort(); } This works: auto makeVoldemort(int x) { struct Voldemort { int value() { return x; } } return Voldemort(); } So it's a problem with property. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Dec 15 2012
http://d.puremagic.com/issues/show_bug.cgi?id=9162 --- Comment #3 from js.mdnq gmail.com 2012-12-15 23:43:35 PST --- When using a normal method instead of a property I then get the error: "Internal Error: ..\ztc\cod2.c 4727" on release build. Debug build does not return this error. 2.060. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Dec 15 2012
http://d.puremagic.com/issues/show_bug.cgi?id=9162 --- Comment #4 from Walter Bright <bugzilla digitalmars.com> 2012-12-16 01:07:31 PST --- (In reply to comment #3)When using a normal method instead of a property I then get the error: "Internal Error: ..\ztc\cod2.c 4727" on release build. Debug build does not return this error. 2.060.Current head does not return errors on normal method. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Dec 16 2012
http://d.puremagic.com/issues/show_bug.cgi?id=9162 Kenji Hara <k.hara.pg gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |pull --- Comment #5 from Kenji Hara <k.hara.pg gmail.com> 2012-12-16 04:42:50 PST --- https://github.com/D-Programming-Language/dmd/pull/1379 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Dec 16 2012
http://d.puremagic.com/issues/show_bug.cgi?id=9162 Walter Bright <bugzilla digitalmars.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |FIXED -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Dec 17 2012