DIP 1031--Deprecate Brace-Style Struct Initializers--Community Review Round 1 Discussion
Walter Bright
newshound2 at digitalmars.com
Thu Feb 13 09:56:27 UTC 2020
On 2/13/2020 1:47 AM, IGotD- wrote:
> However, would
>
> S s = (1, 2);
>
> be allowed inferring the type?
No. But you can write:
auto s = S(1, 2);
> Would there be case where this type of initialization would mask the constructor
> of a type or vice versa?
The constructor takes precedence.
> struct S
> {
> int a, b;
> this(int bp, int ap)
> {
> a = ap;
> b = bp;
> }
> }
>
> writing
>
> S s = S(1, 2);
>
> what would it pick?
The constructor.
More information about the Digitalmars-d
mailing list