List of DMD dependency issue (which would be sloved by a task based system)

Timon Gehr timon.gehr at gmx.ch
Fri Dec 4 10:05:57 UTC 2020


On 04.12.20 09:38, Stefan Koch wrote:
> On Friday, 4 December 2020 at 07:20:38 UTC, Mr T. wrote:
>> Here's one *not* depending on declaration order, an ambiguity bug:
>>
>> ----------------------------------
>> // main.d
>> import ma;
>> import mb;
>> immutable X = Y;    // no error!
>> int main() {
>>     return 0;
>> //    return Y;  // error: ma.Y conflicts with mb.Y
>> }
>> ----------------------------------
>> module ma;
>> enum Y = 48;
>> ----------------------------------
>> module mb;
>> import main;
>> //static if (true)    // main.d: error on X: ma.Y conflicts with mb.Y
>> static if (X == 48) // no error!
>>     enum Y = 64;
>> ----------------------------------
> 
> SDC does detect the ambiguity.
> 
> uplink at uplink-black:~/ambig$ ../d/SDC/bin/sdc main.d
> main.d:4:0: error: Already defined
> int main() {
>      return 0;
> //    return
> ...


So does my frontend (https://github.com/tgehr/d-compiler):

---
mb.d:5:10: error: declaration of 'Y' is invalid
     enum Y = 64;
          ^
main.d:4:15: note: this lookup should have resolved to it otherwise
immutable X = Y;    // no error!
               ^
---

Of course, it does not compile with versions of DMD newer than 2.060 due 
to, ironically, dependency issues. (Rainer once found a fix for the 
problem, but it caused some regressions.)

There are various test cases here (many are for things other than 
dependency issues, but IIRC DMD chokes on quite a few of those too):
https://github.com/tgehr/d-compiler/tree/master/test


More information about the Digitalmars-d mailing list