digitalmars.D.bugs - [Issue 8690] New: Can't access a global enum size_t from a pure function
- d-bugmail puremagic.com (27/27) Sep 18 2012 http://d.puremagic.com/issues/show_bug.cgi?id=8690
- d-bugmail puremagic.com (15/15) Jan 16 2013 http://d.puremagic.com/issues/show_bug.cgi?id=8690
- d-bugmail puremagic.com (11/11) Jan 16 2013 http://d.puremagic.com/issues/show_bug.cgi?id=8690
http://d.puremagic.com/issues/show_bug.cgi?id=8690 Summary: Can't access a global enum size_t from a pure function Product: D Version: D2 Platform: x86 OS/Version: Windows Status: NEW Keywords: rejects-valid Severity: normal Priority: P2 Component: DMD AssignedTo: nobody puremagic.com ReportedBy: bearophile_hugs eml.cc int[1] foo; enum fooLength = 1; void main() pure { auto n1 = fooLength; // OK auto n2 = foo.length; // error } DMD 2.061alpha shows: test.d(5): Error: pure function 'D main' cannot access mutable static data 'foo' But foo.length is a compile-time constant. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Sep 18 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8690 yebblies <yebblies gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |yebblies gmail.com Platform|x86 |All OS/Version|Windows |All While this probably should work, it's tricky to implement because semantic has to work out what foo is to find length, and that triggers the purity check _long_ before it works out length is constant. Workaround: use typeof(foo).length -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jan 16 2013
http://d.puremagic.com/issues/show_bug.cgi?id=8690 yebblies <yebblies gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |DUPLICATE *** This issue has been marked as a duplicate of issue 6654 *** -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jan 16 2013