Thread overview
[Issue 6655] New: Forward error with static array length
Sep 14, 2011
yebblies
Apr 24, 2012
Walter Bright
September 12, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6655

           Summary: Forward error with static array length
           Product: D
           Version: D2
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Keywords: diagnostic, rejects-valid
          Severity: major
          Priority: P2
         Component: DMD
        AssignedTo: nobody@puremagic.com
        ReportedBy: bearophile_hugs@eml.cc


--- Comment #0 from bearophile_hugs@eml.cc 2011-09-12 15:47:11 PDT ---
D2 code:


enum size_t N = 1;
int[bar.length] foo;
int[N] bar;
void main() {}


DMD 2.055 gives:

Error: cannot create associative array int[N]


This is a very nice bug. There are three problems here: refusing valid code, thinking bar is an associative array instead of a fixed-sized one, and giving no line number.

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


yebblies <yebblies@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |yebblies@gmail.com
           Platform|x86                         |All
         OS/Version|Windows                     |All
           Severity|major                       |critical


--- Comment #1 from yebblies <yebblies@gmail.com> 2011-09-14 23:01:52 EST ---
The problem here is that TypeAArray::getImpl is being called on bar before semantic has, therefore there is no scope or location.  Of the three problems, the lack of scope causes the failure to lookup N (and therefore the failure to recognize bar as a static array), and also the lack of a file/line number.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
April 24, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=6655



--- Comment #2 from github-bugzilla@puremagic.com 2012-04-24 00:48:32 PDT ---
Commit pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/b95c7bd8537ac54ab871615dfddec851444a9a0a add test case for Issue 6655

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
April 24, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=6655


Walter Bright <bugzilla@digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |bugzilla@digitalmars.com
         Resolution|                            |WORKSFORME


--- Comment #3 from Walter Bright <bugzilla@digitalmars.com> 2012-04-24 00:49:03 PDT ---
Works in 2.059.

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