[Issue 15167] [REG2.069-devel] conflicting error with repeated alias declaration

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Tue Oct 6 20:48:17 PDT 2015


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

--- Comment #3 from Kenji Hara <k.hara.pg at gmail.com> ---
(In reply to Walter Bright from comment #2)
> Is there a compelling reason to allow:
> 
>    alias a = int;
>    alias a = int;
> 
> ? I can't think of one. The CARD64 example also looks like invalid code that
> happened to be accepted.

Because today, two different alias declarations aliasing an identical type are
allowed if they're accessed beyond the import boundaries.

module a;
    alias ulong CARD64;

module b;
    alias ulong CARD64;

module test;
    import a, b;
    pragma(msg, CARD64);   // OK, ulong is printed

(It's handled in ScopeDsymbol.search.)

So, if there's no ambiguous, I think accepting such the code would be
reasonable.

--


More information about the Digitalmars-d-bugs mailing list