Skip to content

Commit 0176874

Browse files
committed
Enable -preview=fieldwise by default
Introduced in PR dlang#9331, this was changed from a normal bug fix to a -preview switch because enabling it triggered a suprious "statement is not reachable" warning in Phobos. That warning has since been removed (in PR dlang#15568).
1 parent a7f6b04 commit 0176874

4 files changed

Lines changed: 12 additions & 2 deletions

File tree

changelog/dmd.fieldwise.dd

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
`-preview=fieldwise` is now enabled by default
2+
3+
This fixes a bug that affected some struct comparisons using the `==` operator.
4+
For more information, see [the entry for `-preview=fieldwise` in the 2.085.0
5+
changelog](https://dlang.org/changelog/2.085.0.html#no-cmpsb).
6+
7+
The new `-revert=fieldwise` switch can be used to disable the bug fix and
8+
restore the original behavior of the `==` operator.

compiler/src/dmd/cli.d

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -939,6 +939,8 @@ dmd -cov -unittest myprog.d
939939
"https://github.com/dlang/DIPs/blob/master/DIPs/other/DIP1000.md"),
940940
Feature("intpromote", "fix16997", "revert integral promotions for unary + - ~ operators"),
941941
Feature("dtorfields", "dtorFields", "don't destruct fields of partially constructed objects"),
942+
Feature("fieldwise", "fieldwise", "don't use fieldwise comparisons for struct equality",
943+
"https://dlang.org/changelog/2.085.0.html#no-cmpsb"),
942944
];
943945

944946
/// Returns all available previews
@@ -959,7 +961,7 @@ dmd -cov -unittest myprog.d
959961
Feature("bitfields", "bitfields", "add C-like bitfields",
960962
"https://github.com/dlang/dlang.org/pull/3190"),
961963
Feature("fieldwise", "fieldwise", "use fieldwise comparisons for struct equality",
962-
"https://dlang.org/changelog/2.085.0.html#no-cmpsb"),
964+
"https://dlang.org/changelog/2.085.0.html#no-cmpsb", false, false),
963965
Feature("fixAliasThis", "fixAliasThis",
964966
"when a symbol is resolved, check alias this scope before going to upper scopes",
965967
"https://github.com/dlang/dmd/pull/8885"),

compiler/test/compilable/previewhelp.d

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ Upcoming language changes listed by -preview=name:
1010
=dip1008 implement @nogc Throwable DIP (https://github.com/dlang/DIPs/blob/master/DIPs/other/DIP1008.md)
1111
=dip1021 implement Mutable Function Arguments DIP (https://github.com/dlang/DIPs/blob/master/DIPs/accepted/DIP1021.md)
1212
=bitfields add C-like bitfields (https://github.com/dlang/dlang.org/pull/3190)
13-
=fieldwise use fieldwise comparisons for struct equality (https://dlang.org/changelog/2.085.0.html#no-cmpsb)
1413
=fixAliasThis when a symbol is resolved, check alias this scope before going to upper scopes (https://github.com/dlang/dmd/pull/8885)
1514
=rvaluerefparam enable rvalue arguments to ref parameters (https://gist.github.com/andralex/e5405a5d773f07f73196c05f8339435a)
1615
=safer more safety checks by default (https://github.com/WalterBright/documents/blob/38f0a846726b571f8108f6e63e5e217b91421c86/safer.md)

compiler/test/compilable/reverthelp.d

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,6 @@ Revertable language changes listed by -revert=name:
99
=dip1000 revert DIP1000 changes (Scoped Pointers) (https://github.com/dlang/DIPs/blob/master/DIPs/other/DIP1000.md)
1010
=intpromote revert integral promotions for unary + - ~ operators
1111
=dtorfields don't destruct fields of partially constructed objects
12+
=fieldwise don't use fieldwise comparisons for struct equality (https://dlang.org/changelog/2.085.0.html#no-cmpsb)
1213
----
1314
*/

0 commit comments

Comments
 (0)