[Issue 11206] static array can be implicitly built from items, when nested in aggregate

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Oct 10 01:46:55 PDT 2013


http://d.puremagic.com/issues/show_bug.cgi?id=11206


Maxim Fomin <maxim at maxim-fomin.ru> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |rejects-valid


--- Comment #13 from Maxim Fomin <maxim at maxim-fomin.ru> 2013-10-10 01:46:55 PDT ---
(In reply to comment #10)
> (In reply to comment #8)
> > It seems you starting to understand the issue (but I haven't thought whether
> > static arrays are only types supporting this).
> 
> OK. What about this...? Is it a bug?
> 
> //----
> struct S
> {
>   int[1] arr;
> }
> 
> void main()
> {
>   uint[]  udarr;
>   uint[1] usarr;
> 
>   int[1] arr1 = udarr; //OK
>   int[1] arr2 = usarr; //OK
>   S s1 = S(udarr); //NOPE?
>   S s2 = S(usarr); //NOPE?
> }
> //----
> 
> I'm not challenging you, I'm really just trying to understand the rules.

Integer arrays as initializers is completely different story. What you are
trying was not supported and not documented. However, what is more important is
that recently there was an enhacement request to support such conversions (I
don't know issue number) or something similar and consensus was to allow it
(probably there is a pull for it). Since Kenji is in thread he probably may
clarify the situation.

(In general this is currently a dark territory of language.)

> 
> > Anyway this feature was working for years.
> 
> I make no claim to the contrary. Original confusion comes from what I saw as
> "inconsistent", and made the "upside down conclusion". I guess I should have
> filed instead (maybe) that AGG!S(1) should be legal.

OK, marked as rejects-valid.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list