Thread overview | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
|
March 29, 2021 [Issue 21780] deprecation warning for considered but unused alias this | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=21780 moonlightsentinel@disroot.org changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |moonlightsentinel@disroot.o | |rg Hardware|x86_64 |All Summary|alias this preferred over |deprecation warning for |immutable conversion even |considered but unused alias |if alias this is deprecated |this |and de is on | OS|Linux |All Severity|trivial |regression -- |
March 29, 2021 [Issue 21780] alias this preferred over immutable conversion even if alias this is deprecated and de is on | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=21780 moonlightsentinel@disroot.org changed: What |Removed |Added ---------------------------------------------------------------------------- Summary|deprecation warning for |alias this preferred over |considered but unused alias |immutable conversion even |this |if alias this is deprecated | |and de is on -- |
March 29, 2021 [Issue 21780] alias this preferred over immutable conversion even if alias this is deprecated and de is on | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=21780 --- Comment #1 from moonlightsentinel@disroot.org --- This is actually a regression. Extending your example with appropriate puts("Nullable") / puts("S") yields: Up to 2.060 : Success with output: Nullable 2.061 to 2.075.1: <Doesn't compile due to overload resolution error> 2.076.1 to 2.087.1: Success with output: S Since 2.088.1: Success with output: ----- onlineapp.d(14): Deprecation: `alias get_ this` is deprecated S ----- -- |
March 29, 2021 [Issue 21780] alias this preferred over immutable conversion even if alias this is deprecated and de is on | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=21780 --- Comment #2 from FeepingCreature <default_357-line@yahoo.de> --- That's not really a "regression" - well, it is a regression, but it's an expected regression, because Nullable's alias get this is in the process of being deprecated and has been removed in master. A deprecation is functionally equivalent to a regression, that's why there was a year of warning messages. -- |
March 29, 2021 [Issue 21780] alias this preferred over immutable conversion even if alias this is deprecated and de is on | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=21780 --- Comment #3 from FeepingCreature <default_357-line@yahoo.de> --- Oh wait you're right! I thought you were talking about std.typecons.Nullable for a second. It's still not a regression - it's a bugfix: https://issues.dlang.org/show_bug.cgi?id=20033 , I believe. -- |
March 29, 2021 [Issue 21780] alias this preferred over immutable conversion even if alias this is deprecated and de is on | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=21780 --- Comment #4 from moonlightsentinel@disroot.org --- (In reply to FeepingCreature from comment #2) > That's not really a "regression" - well, it is a regression, but it's an This is still a regression. DMD should prefer const-conversions over implicit conversions (e.g. alias this). This extends example exhibits wrong behaviour since 2.061 : (Unless i misunderstood the rules for overload matching) extern(C) void puts(const scope char*); immutable struct S { } struct Nullable { S get_() { return S.init; } deprecated alias get_ this; } void foo(immutable Nullable) { puts("Nullable"); } void foo(immutable S) { puts("S"); } void main() { foo(Nullable()); // prints "S" } -- |
March 29, 2021 [Issue 21780] alias this preferred over immutable conversion even if alias this is deprecated and de is on | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=21780 --- Comment #5 from moonlightsentinel@disroot.org --- The regression refers to the change which overload is called, not the deprecation message. -- |
March 29, 2021 [Issue 21780] alias this preferred over immutable conversion even if alias this is deprecated and de is on | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=21780 --- Comment #6 from moonlightsentinel@disroot.org --- Even worse when removing the immutable from S and using const parameters: extern(C) void puts(const scope char*); struct S { } struct Nullable { S get_() { return S.init; } deprecated alias get_ this; } void foo(const Nullable) { puts("Nullable"); } void foo(const S) { puts("S"); } void main() { foo(Nullable()); // fails due to ambiguity } -- |
Copyright © 1999-2021 by the D Language Foundation