[Issue 5890] New: ICE and wrong scope problem for 2nd argument in static assert with DMD on git master

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Apr 26 04:22:23 PDT 2011


http://d.puremagic.com/issues/show_bug.cgi?id=5890

           Summary: ICE and wrong scope problem for 2nd argument in static
                    assert with DMD on git master
           Product: D
           Version: D2
          Platform: Other
        OS/Version: Mac OS X
            Status: NEW
          Keywords: ice-on-valid-code, rejects-valid
          Severity: regression
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: kennytm at gmail.com


--- Comment #0 from kennytm at gmail.com 2011-04-26 04:18:40 PDT ---
This is a problem on the git master. This does not affect 2.052.

The program below causes an ICE on the git master version:

-------------------------------------------------
class K {
    void f() {
        static assert(0, typeof(this).stringof);
    }
}

void main() {
    (new K).f;
}
-------------------------------------------------
$ dmd2.052/osx/bin/dmd x  # correct
x.d(6): Error: static assert  "K"c
$ dmd x                   # incorrect
Assertion failed: (this != enclosing), function Scope, file scope.c, line 132.
Abort trap
-------------------------------------------------

And the program below thinks the template parameter U does not exist:

-------------------------------------------------
class K {
    static void f(U)() {
        static assert(0, U.stringof);
    }
}

void main() {
    K.f!int();
}
-------------------------------------------------
$ dmd2.052/osx/bin/dmd x  # correct
x.d(6): Error: static assert  "int"c
x.d(11):        instantiated from here: f!(int)
$ dmd x                   # incorrect
x.d(6): Error: undefined identifier U
x.d(6): Error: static assert  __error
x.d(11):        instantiated from here: f!(int)
-------------------------------------------------

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


More information about the Digitalmars-d-bugs mailing list