[Issue 21807] Non-immutable data can be converted to immutable using function call in ctor
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Tue Aug 9 06:51:17 UTC 2022
https://issues.dlang.org/show_bug.cgi?id=21807
Walter Bright <bugzilla at digitalmars.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
CC| |bugzilla at digitalmars.com
Resolution|--- |INVALID
--- Comment #12 from Walter Bright <bugzilla at digitalmars.com> ---
With current master, and @safe applied, the following deprecation is printed
with or without -preview=dip1000:
test.d(8): Deprecation: slice of static array temporary returned by `bb()`
assigned to longer lived variable `this.str`
This message is correct.
Note that since the char[12] is a temporary value, there are no other
references to it, so it can safely be converted to immutable.
Closing as the compiler is working as expected.
--
More information about the Digitalmars-d-bugs
mailing list