[Issue 8243] cannot initialize tuple with an element at module scope but this is allowed in function-local scopes

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Fri Jul 18 10:07:33 PDT 2014


https://issues.dlang.org/show_bug.cgi?id=8243

timon.gehr at gmx.ch changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|cannot initialize tuple     |cannot initialize tuple
                   |with an element at module   |with an element at module
                   |scope                       |scope but this is allowed
                   |                            |in function-local scopes

--- Comment #6 from timon.gehr at gmx.ch ---
(In reply to hsteoh from comment #5)
> I think those look like bugs. While investigating a related issue recently,
> I noted that some parts of dmd don't appear to treat tuple types properly,
> so I wouldn't be surprised if things like what you posted are unintentional
> bugs. To me, it makes no sense to declare something with a tuple type of
> multiple items, yet the initializer receives only one argument.

This is allowed too:

void main(){ int[2] x=2; }

> Even if this is intentionally allowed,

I'd assume so, though /maybe/ the duplication of side-effects is unintentional.

> I'd argue it's a misfeature because it makes it
> too easy for a typo to silently cause bugs.

I don't disagree at all, but the behaviour should in any case be consistent.

--


More information about the Digitalmars-d-bugs mailing list