Thread overview
[Issue 11245] New: [REG 2.063] Can't access length of static arrays from within classes
Oct 13, 2013
Benjamin Thaut
Oct 13, 2013
Benjamin Thaut
Oct 14, 2013
Walter Bright
Oct 18, 2013
Kenji Hara
Oct 18, 2013
Walter Bright
October 13, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=11245

           Summary: [REG 2.063] Can't access length of static arrays from
                    within classes
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Keywords: rejects-valid
          Severity: regression
          Priority: P2
         Component: DMD
        AssignedTo: nobody@puremagic.com
        ReportedBy: code@benjamin-thaut.de


--- Comment #0 from Benjamin Thaut <code@benjamin-thaut.de> 2013-10-13 10:05:38 PDT ---
Created an attachment (id=1262)
repro case

Its no longer possible to access the length of static arrays stored inside other types from within methods of classes. See attached repro case.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
October 13, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=11245


rswhite4@googlemail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |rswhite4@googlemail.com


--- Comment #1 from rswhite4@googlemail.com 2013-10-13 11:40:29 PDT ---
IMO this is correct, because f is not static and belongs to a struct instance. Or did I miss something?

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
October 13, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=11245



--- Comment #2 from Benjamin Thaut <code@benjamin-thaut.de> 2013-10-13 11:46:54 PDT ---
The length of f is known at compile time. There is no need for a this pointer to access it. Also it works if you put the same code into a regular function. It stops working inside methods. Additionaly this is a regression. It used to work in dmd 2.060.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
October 14, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=11245


Walter Bright <bugzilla@digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bugzilla@digitalmars.com


--- Comment #3 from Walter Bright <bugzilla@digitalmars.com> 2013-10-14 15:17:52 PDT ---
The repro case:
-----------------------
struct Vec2
{
  float f[2];
}

class Bar
{
    void func()
    {
      float[Vec2.f.length] newVal;
    }
}

void main(string[] args)
{
  (new Bar).func();
}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
October 18, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=11245


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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull


--- Comment #4 from Kenji Hara <k.hara.pg@gmail.com> 2013-10-18 09:25:15 PDT ---
https://github.com/D-Programming-Language/dmd/pull/2679

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
October 18, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=11245



--- Comment #5 from github-bugzilla@puremagic.com 2013-10-18 13:23:14 PDT ---
Commits pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/9ed249a167eaac3ccf37c02a88cddbc27d02b683 fix Issue 11245 - Can't access length of static arrays from within classes

https://github.com/D-Programming-Language/dmd/commit/87664d93149f24cc70a253742f4c25ece9ab472f Merge pull request #2679 from 9rnsr/fix11245

[REG2.063] Issue 11245 - Can't access length of static arrays from within classes

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
October 18, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=11245



--- Comment #6 from github-bugzilla@puremagic.com 2013-10-18 13:24:09 PDT ---
Commit pushed to 2.064 at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/a913ce4bc59a94a022a27e390fc841f4aededffb Merge pull request #2679 from 9rnsr/fix11245

[REG2.063] Issue 11245 - Can't access length of static arrays from within classes

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
October 18, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=11245


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: -------