Thread overview
[Issue 7434] New: Error involving array literal created in ctfe gives wrong line number
Feb 04, 2012
yebblies
Feb 04, 2012
yebblies
Feb 04, 2012
yebblies
Feb 04, 2012
yebblies
February 04, 2012
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


--- Comment #0 from yebblies <yebblies@gmail.com> 2012-02-04 18:02:53 EST ---


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



--- Comment #1 from yebblies <yebblies@gmail.com> 2012-02-04 18:03:18 EST ---
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: -------
February 04, 2012
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


--- Comment #2 from yebblies <yebblies@gmail.com> 2012-02-04 18:18:54 EST ---
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: -------
February 04, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=7434


yebblies <yebblies@gmail.com> changed:

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


--- Comment #3 from yebblies <yebblies@gmail.com> 2012-02-04 18:25:41 EST ---
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: -------