[Issue 7419] New: [2.058/CTFE] Constructor of struct is overwritten inside a unittest with -inline

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Feb 1 11:48:04 PST 2012


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

           Summary: [2.058/CTFE] Constructor of struct is overwritten
                    inside a unittest with -inline
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Keywords: CTFE
          Severity: regression
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: kennytm at gmail.com


--- Comment #0 from kennytm at gmail.com 2012-02-01 11:48:03 PST ---
Test case:

-----------------
struct X7419 {
    double x;
    this(double x) {
        this.x = x;
    }
}
unittest {
    enum x = {
        auto p = X7419(3);
        return p.x;
    }();
    static assert(x == 3);
}
-----------------

Compile with:

    dmd -unittest -inline -c test7419.d

Gives the unexpected error:

    test7419.d(12): Error: static assert  (nan == 3) is false

The bug was introduced in commit 40160a53a0c72bfbad2e0ad36ec8f1ccbb76ce8d.

-- 
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