You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The compiler allows implicitly converting a return value with indirections to immutable if it determines the result must be unique.
276
+
The compiler allows implicitly converting a return value with indirections to immutable if it determines the result is unique.
277
277
Formerly, this check would inspect the types of the indirections, and forget to take into account conversions, such as `int[]` to `void[]`:
278
278
)
279
279
@@ -296,7 +296,7 @@ void main()
296
296
$(P
297
297
This was filed as [issue 15660](https://issues.dlang.org/show_bug.cgi?id=15660), which has been fixed some time ago by making the check more strict: the called function must be strongly pure.
298
298
However, to avoid breaking code, the fix was only active with the `-preview=dip1000` switch.
299
-
Since it is unrelated to dip1000 (which is about `scope` pointers), the fix has been moved to a new `-preview=fixImmmutableConv` switch.
299
+
Since it is unrelated to dip1000 (which is about `scope` pointers), the fix has been moved to a new `-preview=fixImmutableConv` switch.
Copy file name to clipboardExpand all lines: changelog/2.105.0.dd
+26-1Lines changed: 26 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -5,7 +5,7 @@ $(CHANGELOG_NAV_INJECT)
5
5
$(VERSION Aug 01, 2023, =================================================,
6
6
7
7
$(CHANGELOG_HEADER_STATISTICS
8
-
$(VER) comes with 11 major changes and 59 fixed Bugzilla issues.
8
+
$(VER) comes with 12 major changes and 59 fixed Bugzilla issues.
9
9
A huge thanks goes to the
10
10
$(LINK2 #contributors, 34 contributors)
11
11
who made $(VER) possible.)
@@ -18,6 +18,7 @@ $(LI $(RELATIVE_LINK2 dmd.enum-function,Functions can no longer have `enum` stor
18
18
$(LI $(RELATIVE_LINK2 dmd.extern-c-overload,Overloading `extern(C)` functions is now an error))
19
19
$(LI $(RELATIVE_LINK2 dmd.private-deprecation-error,Deprecation phase ended for access to private method when overloaded with public method.))
20
20
$(LI $(RELATIVE_LINK2 dmd.visionos-version-identifier,Added predefined version identifier `VisionOS`))
21
+
$(LI $(RELATIVE_LINK2 dmd.allow-parentheses-for-call,Do not error with a C cast when surrounding a type or expression in parentheses when calling or constructing.))
21
22
22
23
)
23
24
@@ -174,6 +175,30 @@ This is Apple's new operating system for their VR/AR device Vision Pro.
174
175
)
175
176
)
176
177
178
+
$(LI $(LNAME2 dmd.allow-parentheses-for-call,Do not error with a C cast when surrounding a type or expression in parentheses when calling or constructing.)
179
+
$(P
180
+
Previous to this version, an expression like `(IdentifierOrBasicType)(Expression)` would be considered a c-style cast,
181
+
and disallowed, even if the `IdentifierOrBasicType` could be used as a callable. This is now allowed, as long as the expression is a call, or a construction.
182
+
183
+
```
184
+
struct S { int x; }
185
+
int foo(int x) { return x; }
186
+
auto bar = &foo;
187
+
188
+
// these were previously disallowed
189
+
auto s = (S)(5); // equivalent to S(5)
190
+
auto f = (foo)(5); // equivalent to foo(5)
191
+
auto b = (bar)(5); // equivalent to bar(5)
192
+
auto i = (int)(5); // equivalent to int(5), not a cast.
193
+
194
+
// these are not allowed
195
+
auto bad = (int)5; // Error: C style cast illegal, use `cast(int)5`
196
+
auto bad2 = (ubyte)(12345); // Error: cannot implicitly convert expression `12345` of type `int` to `ubyte`
197
+
```
198
+
)
199
+
200
+
$(P See $(BUGZILLA 24025): Expressions contained in parentheses should not be assumed to be C casts)
0 commit comments