[Issue 3614] New: empty tuples not assignable: Error: tuple has no effect in expression (tuple())

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Dec 13 17:29:30 PST 2009


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

           Summary: empty tuples not assignable: Error: tuple has no
                    effect in expression (tuple())
           Product: D
           Version: 1.051
          Platform: Other
        OS/Version: All
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: nfxjfg at gmail.com


--- Comment #0 from nfxjfg at gmail.com 2009-12-13 17:29:20 PST ---
First off, this report is for 1.053, but I could select only up to 1.051.

Apparently empty tuples can't be assigned, thus creating special cases whenever
a tuple happens to have 0 elements.

The following code fails to compile and I think it shouldn't:

void foo(T...)(T a) {
    struct X {
        T a;
    }
    X x;
    x.a = a;  //line 6
}

void test() {
    foo!(int)(0); //works
    foo!()();     //fails
}

void main() {}

Compilation fails with:

a.d(6): Error: tuple has no effect in expression (tuple())
a.d(11): Error: template instance a.foo!() error instantiating

Not sure how this is related to bug 3278 or bug 3600.

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