Bug 23771 – Array equals should be handled by CTFE

Status
NEW
Severity
enhancement
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2023-03-11T00:13:38Z
Last change time
2024-12-13T19:27:42Z
Keywords
CTFE
Assigned to
No Owner
Creator
Walter Bright
Moved to GitHub: dmd#20245 →

Comments

Comment #0 by bugzilla — 2023-03-11T00:13:38Z
Array Equals gets lowered to __equals(), but CTFE should not rely on it. This change to expressionsem.d demonstrates it: --- // lower some array comparisons to object.__equals(e1, e2) if (sc.needsCodegen() && <== add this test (needsArrayLowering || (t1.ty == Tarray && t2.ty == Tarray))) { //printf("Lowering to __equals %s %s\n", exp.e1.toChars(), exp.e2.toChars()); --- resulting in: fail_compilation/diag7420.d(22): called from here: `__equals(y, "abc")`
Comment #1 by bugzilla — 2023-03-11T00:18:44Z
Comment #2 by dlang-bot — 2023-05-17T11:42:41Z
@WalterBright updated dlang/dmd pull request #14981 "lower array equals only if it needs code gen" mentioning this issue: - Update failing tests + Fix Issue 23771 https://github.com/dlang/dmd/pull/14981
Comment #3 by robert.schadek — 2024-12-13T19:27:42Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/20245 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB