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



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




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



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



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



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



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