www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Wrong compiler error message regarding overload sets

Hi,

for the source code below, the compiler says:

app.d(26): constructor `app.TObject.this` hides base class 
function `app.DelphiObject.this`
app.d(26): add `alias this = app.DelphiObject.this` to 
`app.TObject`'s body to merge the overload sets

But if I add `alias this = app.DelphiObject.this` then the 
compiler says, the syntax is wrong:

Error: identifier or `new` expected following `.`, not `this`
app.d(20): Error: cannot use syntax `alias this = 
app.DelphiObject`, use `alias app.DelphiObject this` instead

But If I use `alias app.DelphiObject this` then another error is 
shown:
app.d(22): Error: no identifier for declarator `app.DelphiObject`
app.d(22):        `this` is a keyword, perhaps append `_` to make 
it an identifier

What is the correct "alias this" syntax to be able to access the 
super constructor (DelphiObjectReference)?

``` d
struct DelphiObjectReference
{
     ptrdiff_t reference;
}

mixin template PascalClass(string name)
{
     this (DelphiObjectReference r){}
}

class DelphiObject
{
     this(){}
     this (DelphiObjectReference r){}
}

class TObject : DelphiObject
{
     mixin PascalClass!("System.TObject");

     this(TObject AOwner){}
}

void main()
{
     new TObject(DelphiObjectReference(123));
}
```

Kind regards
André
Feb 07 2023