[Issue 1625] New: cannot evaluate function @compile-time when return type includes a union

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Oct 29 02:51:03 PDT 2007


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

           Summary: cannot evaluate function @compile-time when return type
                    includes a union
           Product: D
           Version: 2.006
          Platform: PC
               URL: http://paste.dprogramming.com/dpjhoxzy
        OS/Version: Windows
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla at digitalmars.com
        ReportedBy: spam at extrawurst.org


dmd refuses to compile the following legal code:

[CODE]
struct Foo {

    union {
        struct {
            float x,y,z;
        }
        float[3] _v;
    }

    static Foo bar(){
        Foo f;
        return f;
    }
}

void main() {
    const Foo foo = Foo.bar();//Error: cannot evaluate bar() at compile time
}
[/CODE]

i hope i am right that it should work and is valid code.


-- 



More information about the Digitalmars-d-bugs mailing list