www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 7434] New: Error involving array literal created in ctfe gives wrong line number

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

           Summary: Error involving array literal created in ctfe gives
                    wrong line number
           Product: D
           Version: D1 & D2
          Platform: All
        OS/Version: All
            Status: NEW
          Keywords: diagnostic
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: yebblies gmail.com
        ReportedBy: yebblies gmail.com





-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 03 2012
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=7434




int[string] initHash(in string[] words) {
        int[string] h;

        for (auto i=0; i < words.length; i++) {
                h[words[i]] = i; // Compiler points to this line and says:
//Error: non-constant expression ["abc":0,"def":1,"ghi":2]
        }

        return h;
}

int[string] hash3 = initHash(["abc", "def", "ghi"]);

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 03 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=7434


yebblies <yebblies gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|yebblies gmail.com          |clugdbug yahoo.com.au



I can't see how to do this, but I assume there's a clean way to trace back to
the CallExp that's being interpreted and use that's Loc.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 03 2012
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=7434


yebblies <yebblies gmail.com> changed:

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



Actually never mind, this is the same thing as 3812, and the patch there fixes
it.

*** This issue has been marked as a duplicate of issue 3812 ***

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