Alias this does not work with pointers?

Nicholas Wilson via Digitalmars-d digitalmars-d at puremagic.com
Wed Mar 9 17:25:44 PST 2016


struct Bar_T; // opaque
alias Bar = Bar_T*;
void someFuncIWantWrapped(Bar* bar)
{
}
struct Foo
{
     Bar bar;
     alias bar this;
}
void someFunc(Foo* foo)
{
    someFuncIWantWrapped(foo);
}

gives
Error: function someFuncIWantWrapped (Bar_T** bar) is not 
callable using argument types Foo*

I feel like this should work.

Yes I realise that I can fix it by
void someFunc(Foo foo)
{
    someFuncIWantWrapped(&foo.bar);
}

but I'm generating this and  the name of bar changes and in 
generated from multiple code paths.

Should I report this as a bug?



More information about the Digitalmars-d mailing list