Unable to understand this compiler error

Jesse Phillips jessekphillips+D at gmail.com
Wed Oct 10 08:18:47 PDT 2012


On Wednesday, 10 October 2012 at 14:52:00 UTC, Lubos Pintes wrote:
> Hi,
> I discovered this while playing with DGUI's treeview module. 
> Here is a program that generates exactly the same error that 
> looks weird to me:
> module a;
> import std.stdio;
>
> alias void* pvoid;
>
> enum E : pvoid {
>   a=cast(pvoid)-1,
>   b=cast(pvoid)-2,
> }
>
> void foo(E e=E.a) {
>   writeln("Hello from foo");
> }
>
> void main() {
>   foo();
> }
>
> a.d(11): Error: no property 'a' for type 'void'
>
> I see no "void" there, except that foo has a return type of 
> void.

I'm guessing a compiler bug. Looks to me as though it is 
confusing E to be of type void (you declared it to be enumeration 
of void*)


More information about the Digitalmars-d-learn mailing list