Alias this member shadowed by imported function identifier?

Johan Engelen via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri May 27 06:33:40 PDT 2016


The following code compiles with DMD 2.070, but not with 2.071:

```
module mod;

import std.range;

struct S
{
     struct Inner
     {
         int unique_identifier_name;
         int tail;
     }

     Inner inner;
     alias inner this;

     auto works()
     {
         return unique_identifier_name;
     }

     auto fails()
     {
         return tail; // Line 22
         // The workaround:  return this.tail;
     }
}
```

The 2.071 error is:
tail.d(22): Error: template tail(Range)(Range range, size_t n) if 
(isInputRange!Range && !isInfinite!Range && (hasLength!Range || 
isForwardRange!Range)) has no type

Is this because of the new import rules, or is it a bug?

Thanks,
   Johan



More information about the Digitalmars-d-learn mailing list