www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 12025] New: Wrong purity violation accessing the length of a fixed size array

reply d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=12025

           Summary: Wrong purity violation accessing the length of a fixed
                    size array
           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


--- Comment #0 from bearophile_hugs eml.cc 2014-01-29 08:22:21 PST ---
struct Foo {
    int[5] bar;
}
void main() pure {
    enum size_t n1 = typeof(Foo.bar).length; // OK
    enum size_t n2 = Foo.bar.length; // error
}


DMD 2.065beta gives a wrong error, because Foo.bar.length is a compile-time
constant that can't break purity:

test.d(6): Error: pure nested function 'main' cannot access mutable data 'bar'

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jan 29 2014
next sibling parent d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=12025


Kenji Hara <k.hara.pg gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull
           Platform|x86                         |All
         OS/Version|Windows                     |All


--- Comment #1 from Kenji Hara <k.hara.pg gmail.com> 2014-02-20 00:45:42 PST ---
https://github.com/D-Programming-Language/dmd/pull/3303/files

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 20 2014
prev sibling next sibling parent d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=12025



--- Comment #2 from github-bugzilla puremagic.com 2014-02-20 15:25:17 PST ---
Commits pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/50bcf60631f2f03a9f2e6d200052ec0a615953c1
fix Issue 12025 - Wrong purity violation accessing the length of a fixed size
array

https://github.com/D-Programming-Language/dmd/commit/559ad04e6d9cf444a0104eea32e45b68f5016e7a
Merge pull request #3303 from 9rnsr/fix12025

Issue 12025 - Wrong purity violation accessing the length of a fixed size array

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 20 2014
prev sibling parent d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=12025


Kenji Hara <k.hara.pg gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED


-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 20 2014