www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 24237] New: BetterC: equality of static arrays fails in betterC

https://issues.dlang.org/show_bug.cgi?id=24237

          Issue ID: 24237
           Summary: BetterC: equality of static arrays fails in betterC
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Keywords: betterC, rejects-valid
          Severity: major
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: dave287091 gmail.com

This program fails to compile:


struct Foo {
    int x;
}

extern(C)
int main(){
    Foo fa, fb;
    int x = fa == fb;
    Foo[2] a, b;
    x +=  a == b; // Error: expression `a == b` uses the GC and cannot be used
with switch `-betterC`
    return x;
}

This should just work, and the idea that `a == b` uses the GC is ridiculous.

--
Nov 09 2023