www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 3779] New: ["123"][0][$-1] causes __dollar unresolved in compile-time.

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

           Summary: ["123"][0][$-1] causes __dollar unresolved in
                    compile-time.
           Product: D
           Version: 2.041
          Platform: Other
        OS/Version: Mac OS X
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: kennytm gmail.com


--- Comment #0 from kennytm gmail.com 2010-02-07 08:21:04 PST ---
Consider the following sniplet:

----------------------------------------------------------
template E(){
    enum E=["123"][0][$-1];
}
pragma(msg, E!());

import std.stdio;
void main() {
    writeln(E!());
}
----------------------------------------------------------

Compiling with "dmd" (r287) gives:

----------------------------------------------------------
(["123"][0u])[__dollar - 1u]
Undefined symbols:
  "_D1a6__T1EZ8__dollark", referenced from:
      _D1a6__T1EZ8__dollark$non_lazy_ptr in a.o
     (maybe you meant: _D1a6__T1EZ8__dollark$non_lazy_ptr)
ld: symbol(s) not found
collect2: ld returned 1 exit status
--- errorlevel 1
----------------------------------------------------------

where the expected output from the compiler should be:

----------------------------------------------------------
'3'
----------------------------------------------------------

and links the binary successfully.

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



--- Comment #1 from kennytm gmail.com 2010-02-07 08:33:11 PST ---
A simpler test case is 

import std.stdio;
enum E=["123"][0][$-1];
void main() { writeln(E); }

No templates required.

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


Don <clugdbug yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |clugdbug yahoo.com.au


--- Comment #2 from Don <clugdbug yahoo.com.au> 2010-02-07 12:18:46 PST ---
Should the title be '... unresolved at link time' ? If so, it applies to
Windows as well.

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


Don <clugdbug yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |link-failure, rejects-valid
         OS/Version|Mac OS X                    |All


--- Comment #3 from Don <clugdbug yahoo.com.au> 2010-06-08 14:19:09 PDT ---
Even simpler test case:
----
static const E=["123"][0][$-1];
----
bug.d(1): Error: non-constant expression (["123"][0u])[__dollar - 1u]

This is a constant-folding issue.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jun 08 2010
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3779


Walter Bright <bugzilla digitalmars.com> changed:

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


--- Comment #4 from Walter Bright <bugzilla digitalmars.com> 2011-04-23
15:49:56 PDT ---
D1 Fix:
https://github.com/D-Programming-Language/dmd/commit/da0159d02d0e4ecb7ad1afa4bc6da402e677846f

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Apr 23 2011
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3779


kennytm gmail.com changed:

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


--- Comment #5 from kennytm gmail.com 2011-04-30 11:52:44 PDT ---
Fixed on D2 as well.

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