www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 7770] New: __dollar cannot be read at compile time

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

           Summary: __dollar cannot be read at compile time
           Product: D
           Version: D2
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: bearophile_hugs eml.cc



D2 code:

import std.ascii: uppercase;
import std.string: maketrans;
void main() {
    static r = maketrans(uppercase, uppercase[0 .. $]);
}


DMD 2.059head:

test.d(4): Error: variable __dollar cannot be read at compile time
test.d(4):        called from here:
maketrans(cast(const(char[]))uppercase,cast(const(char[]))uppercase[0u..__dollar])

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


dawg dawgfoto.de changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |dawg dawgfoto.de
         Resolution|                            |INVALID



D has no runtime initialization for static variables.
Therefor the initializer must be constant.

The error message could be better though.

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


dawg dawgfoto.de changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |CTFE
             Status|RESOLVED                    |REOPENED
         Resolution|INVALID                     |



cat > bug.d << CODE
immutable char[5] foo = "abcde";

int bar(string a, string b)
{
    return 0;
}

void baz()
{
    enum s = bar(foo, foo[0 .. $]);
}

// Assertion failed: (!v->isDataseg() || v->isCTFE()), function push, file
interpret.c, line 108.
version (none)
enum s = bar(foo, foo[0 .. $]);
CODE

dmd -c bug

--------

Sorry, you're point was obviously that __dollar should be resolvable
at compile time.

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




*** Issue 7771 has been marked as a duplicate of this issue. ***

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




Commits pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/59ee1fa13ff8f921bfe45307ea595fae7ea51fa7
Fix issue 7770 __dollar cannot be read at compile time

It is always a CTFE variable, even if in global scope.

https://github.com/D-Programming-Language/dmd/commit/4ff8864319107a802430cc1117fb560a1dcd6383


Fix issue 7770 __dollar cannot be read at compile time

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


Walter Bright <bugzilla digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|REOPENED                    |RESOLVED
                 CC|                            |bugzilla digitalmars.com
         Resolution|                            |FIXED


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


Don <clugdbug yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |degener_trash mail.ru



*** Issue 8419 has been marked as a duplicate of this issue. ***

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