D - bug compiler message
- Ant (9/9) Mar 16 2004 compiler said:
- J C Calvarese (18/32) Mar 16 2004 I don't quite know how you got your error message, but this is the
- J Anderson (21/50) Mar 16 2004 Shouldn't that be?
- J Anderson (9/72) Mar 16 2004 Actually, there's a semantic bug here:
- J C Calvarese (16/41) Mar 16 2004 [...]
- Ant (7/12) Mar 16 2004 that's it!
- Ant (11/30) Mar 16 2004 I sorry two mistakes on my post
- J C Calvarese (17/37) Mar 16 2004 Now, I've seen it for myself (WinXP). Wow, that may be the strangest
- larry cowan (3/40) Mar 17 2004 dmd/src/dmd/dsymbol.c line 76
- J Anderson (14/23) Mar 16 2004 You mean something like the following?
- Ant (4/21) Mar 16 2004 TreeIter[char[]] iterMap;
compiler said: declaration __anonymous.k is already defined from: foreach(char[] key, TreeIter ; iterMap) { printf("key = %.*s\n", key); } // missing var after TreeIter Ant
Mar 16 2004
Ant wrote:compiler said: declaration __anonymous.k is already defined from: foreach(char[] key, TreeIter ; iterMap) { printf("key = %.*s\n", key); } // missing var after TreeIter AntI don't quite know how you got your error message, but this is the message I came up with (Windows version): Assertion failure: '0' on line 658 in file 'statement.c' abnormal program termination It's not very descriptive, either. Here's the code I used (so that everyone can play along at home): void main() { char[] iterMap; foreach(char[] key, int; iterMap) /* missing identifier before ; */ { printf("key = %.*s\n", key); } } -- Justin http://jcc_7.tripod.com/d/
Mar 16 2004
J C Calvarese wrote:Ant wrote:Shouldn't that be? void main() { char[] iterMap; foreach(int i, char key; iterMap) { printf("key = %.*s\n", key); } } or even simpler? void main() { char[] iterMap; foreach(char key; iterMap) { printf("key = %.*s\n", key); } } -- -Anderson: http://badmama.com.au/~anderson/compiler said: declaration __anonymous.k is already defined from: foreach(char[] key, TreeIter ; iterMap) { printf("key = %.*s\n", key); } // missing var after TreeIter AntI don't quite know how you got your error message, but this is the message I came up with (Windows version): Assertion failure: '0' on line 658 in file 'statement.c' abnormal program termination It's not very descriptive, either. Here's the code I used (so that everyone can play along at home): void main() { char[] iterMap; foreach(char[] key, int; iterMap) /* missing identifier before ; */ { printf("key = %.*s\n", key); } }
Mar 16 2004
J Anderson wrote:J C Calvarese wrote:Actually, there's a semantic bug here: Do you want to go cycle though chars or strings? I mean you should either use: printf("key = %c\n", key); or (with the appropriate changes in the for loop) char[][] iterMap; -- -Anderson: http://badmama.com.au/~anderson/Ant wrote:Shouldn't that be? void main() { char[] iterMap; foreach(int i, char key; iterMap) { printf("key = %.*s\n", key); } } or even simpler? void main() { char[] iterMap; foreach(char key; iterMap) { printf("key = %.*s\n", key); } }compiler said: declaration __anonymous.k is already defined from: foreach(char[] key, TreeIter ; iterMap) { printf("key = %.*s\n", key); } // missing var after TreeIter AntI don't quite know how you got your error message, but this is the message I came up with (Windows version): Assertion failure: '0' on line 658 in file 'statement.c' abnormal program termination It's not very descriptive, either. Here's the code I used (so that everyone can play along at home): void main() { char[] iterMap; foreach(char[] key, int; iterMap) /* missing identifier before ; */ { printf("key = %.*s\n", key); } }
Mar 16 2004
J Anderson wrote:J Anderson wrote:[...][...]J C Calvarese wrote:[...]Ant wrote:I realize that my code was invalid. I think Ant's point was that nonsense was emitted by DMD instead of a helpful error message. (Hence the subject "bug compiler MESSAGE".) I'm not sure what Ant was trying to do. I suspect he figured out how to accomplish his goal, but he was trying to clue Walter into a circumstance where the compiler produces an odd message. I spent a little time completing his example to try to reproduce his problem. I though my code had an interesting result, too, so I shared it. Sorry, if I was unclear in my first reply. -- Justin http://jcc_7.tripod.com/d/Actually, there's a semantic bug here: Do you want to go cycle though chars or strings? I mean you should either use: printf("key = %c\n", key); or (with the appropriate changes in the for loop) char[][] iterMap;Shouldn't that be? void main() { char[] iterMap; foreach(int i, char key; iterMap) { printf("key = %.*s\n", key); } }
Mar 16 2004
In article <c38h8i$31km$1 digitaldaemon.com>, J C Calvarese says...I realize that my code was invalid. I think Ant's point was that nonsense was emitted by DMD instead of a helpful error message. (Hence the subject "bug compiler MESSAGE".)that's it! Do he have a better subject? (I'm sure I'll find more...)I'm not sure what Ant was trying to do. I suspect he figured out how to accomplish his goal,Yes, thank you, I don't require assistance with this problem, sorry if I mislead you... Ant
Mar 16 2004
In article <c38de7$2rmi$1 digitaldaemon.com>, J C Calvarese says...Ant wrote:I sorry two mistakes on my post 1. it's an associative array, 2. I changed the code before posting but forgot to copy the compiler message again: foreach(char[] k, TreeIter ; iterMap) { printf("k = %.*s\n", k); } // it has "k" instead of "key" Antcompiler said: declaration __anonymous.k is already defined from: foreach(char[] key, TreeIter ; iterMap) { printf("key = %.*s\n", key); } // missing var after TreeIter AntI don't quite know how you got your error message, but this is the message I came up with (Windows version): Assertion failure: '0' on line 658 in file 'statement.c' abnormal program termination
Mar 16 2004
Ant wrote:In article <c38de7$2rmi$1 digitaldaemon.com>, J C Calvarese says...[...]Ant wrote:compiler said: declaration __anonymous.k is already definedI sorry two mistakes on my post 1. it's an associative array, 2. I changed the code before posting but forgot to copy the compiler message again: foreach(char[] k, TreeIter ; iterMap) { printf("k = %.*s\n", k); } // it has "k" instead of "key" AntNow, I've seen it for myself (WinXP). Wow, that may be the strangest error message I've ever seen. Here's the code I used: alias int TreeIter; void main() { char[char[]] iterMap; foreach(char[] k, TreeIter ; iterMap) { printf("k = %.*s\n", k); } } -- Justin http://jcc_7.tripod.com/d/
Mar 16 2004
In article <c38ink$2ds$1 digitaldaemon.com>, J C Calvarese says...Ant wrote:dmd/src/dmd/dsymbol.c line 76 dmd/src/dmd/template.c line 1302In article <c38de7$2rmi$1 digitaldaemon.com>, J C Calvarese says...Ant wrote:compiler said: declaration __anonymous.k is already defined[...]I sorry two mistakes on my post 1. it's an associative array, 2. I changed the code before posting but forgot to copy the compiler message again: foreach(char[] k, TreeIter ; iterMap) { printf("k = %.*s\n", k); } // it has "k" instead of "key" AntNow, I've seen it for myself (WinXP). Wow, that may be the strangest error message I've ever seen. Here's the code I used: alias int TreeIter; void main() { char[char[]] iterMap; foreach(char[] k, TreeIter ; iterMap) { printf("k = %.*s\n", k); } } -- Justin http://jcc_7.tripod.com/d/
Mar 17 2004
Ant wrote:compiler said: declaration __anonymous.k is already defined from: foreach(char[] key, TreeIter ; iterMap) { printf("key = %.*s\n", key); } // missing var after TreeIter AntYou mean something like the following? void main() { char[][] iterMap; iterMap.length = 10; iterMap[0] = "hi"; foreach(char [] key; iterMap) { printf("key = %.*s\n", key); } } -- -Anderson: http://badmama.com.au/~anderson/
Mar 16 2004
In article <c38eeh$2t4s$1 digitaldaemon.com>, J Anderson says...Ant wrote:TreeIter[char[]] iterMap; It's a DUI program (leds). Antcompiler said: declaration __anonymous.k is already defined from: foreach(char[] key, TreeIter ; iterMap) { printf("key = %.*s\n", key); } // missing var after TreeIter AntYou mean something like the following?
Mar 16 2004