www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 11534] New: [CTFE] inout + returning a pointer into a member array

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

           Summary: [CTFE] inout + returning a pointer into a member array
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: dmitry.olsh gmail.com


--- Comment #0 from Dmitry Olshansky <dmitry.olsh gmail.com> 2013-11-17
01:49:04 PST ---
Somewhat reduced test case:

struct MultiArray
{
    this(size_t[] sizes...)
    {
        storage = new size_t[5];
    }

     property auto raw_ptr()inout //removing inout helps
    {
        return storage.ptr+1;
    }
    size_t[] storage;
}

enum test = (){
    auto m = MultiArray(3,2,1);
    auto start = m.raw_ptr;   //this trigger the bug
    //auto start = m.storage.ptr + 1; //this obviously works
    return 0;
}();

Output:
bug_ctfe.d(17): Error: cannot cast [0u, 0u, 0u, 0u, 0u][1] to uint* at compile
time

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Nov 17 2013
next sibling parent d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=11534


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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |CTFE, pull, rejects-valid


--- Comment #1 from Kenji Hara <k.hara.pg gmail.com> 2013-11-17 06:02:42 PST ---
https://github.com/D-Programming-Language/dmd/pull/2800

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Nov 17 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=11534



--- Comment #2 from github-bugzilla puremagic.com 2013-11-17 07:30:00 PST ---
Commits pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/8c1f04de181505031e2c3d60e933e8a2dbbb4fc8
fix Issue 11534 - [CTFE] inout + returning a pointer into a member array

https://github.com/D-Programming-Language/dmd/commit/66535891ffa9897e99ff9a2bb830e01d7688b87e
Merge pull request #2800 from 9rnsr/fix11534

Issue 11534 - [CTFE] inout + returning a pointer into a member array

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Nov 17 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=11534


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: -------
Nov 17 2013
prev sibling parent d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=11534


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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |code dawg.eu


--- Comment #3 from Kenji Hara <k.hara.pg gmail.com> 2014-01-21 17:40:53 PST ---
*** Issue 11958 has been marked as a duplicate of this issue. ***

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