digitalmars.D.learn - Unable to understand this compiler error
- Lubos Pintes (18/18) Oct 10 2012 Hi,
- Jesse Phillips (4/24) Oct 10 2012 I'm guessing a compiler bug. Looks to me as though it is
- bearophile (13/15) Oct 10 2012 Minimized:
- Lubos Pintes (7/20) Oct 10 2012 Interesting. In treeview module I mentioned, there is an enum containing...
- bearophile (5/11) Oct 10 2012 Anyway, this seems a compiler bug, so probably it should be added
- bearophile (1/3) Oct 11 2012 http://d.puremagic.com/issues/show_bug.cgi?id=8802
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.
Oct 10 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*)
Oct 10 2012
Lubos Pintes:I see no "void" there, except that foo has a return type of void.Minimized: enum Foo : void* { a = null } void main() { auto f = Foo.a; } enums are good for ints, ubytes, longs, chars, etc. The more types you try to put in them, the more compiler holes you will find. Bye, bearophile
Oct 10 2012
Interesting. In treeview module I mentioned, there is an enum containing some numeric values cast from HTREEITEM, which is in fact HANDLE, which is void* if I understand properly. I tried to convert DGUI to use dsource' WindowsAPI project, and at least from compiler perspective, everything worked except this TreeView weirdness... Dňa 10. 10. 2012 17:51 bearophile wrote / napísal(a):Lubos Pintes:I see no "void" there, except that foo has a return type of void.Minimized: enum Foo : void* { a = null } void main() { auto f = Foo.a; } enums are good for ints, ubytes, longs, chars, etc. The more types you try to put in them, the more compiler holes you will find. Bye, bearophile
Oct 10 2012
Lubos Pintes:Interesting. In treeview module I mentioned, there is an enum containing some numeric values cast from HTREEITEM, which is in fact HANDLE, which is void* if I understand properly. I tried to convert DGUI to use dsource' WindowsAPI project, and at least from compiler perspective, everything worked except this TreeView weirdness...Anyway, this seems a compiler bug, so probably it should be added to bugzilla. Bye, bearophile
Oct 10 2012
Anyway, this seems a compiler bug, so probably it should be added to bugzilla.http://d.puremagic.com/issues/show_bug.cgi?id=8802
Oct 11 2012