Thread overview | ||||||||
---|---|---|---|---|---|---|---|---|
|
August 27, 2005 continue with the label in foreach | ||||
---|---|---|---|---|
| ||||
http://f17.aaa.livedoor.jp/~labamba/?BugTrack%2F20 This bug reported by nagadomi in japanese d language wiki. I don't know, this bug already reported. But, I write this. if (alreadyReported) writefln("sorry. m(_ _)m"); In foreach of the class with the onApply method, When continue with the label was used, it was displayed, "Internal error: s2ir.c481". I used compiler DMD v0.129. I can't download DMD v0.130. import std.stream; void parse(Stream stream) { _READ_LINE: foreach (char [] line; stream) { if (line.length == 0) { continue _READ_LINE; } } } int main() { return 0; } thanks, Hiroshi Sakurai. |
August 27, 2005 Re: continue with the label in foreach | ||||
---|---|---|---|---|
| ||||
Posted in reply to Hiroshi Sakurai | Hiroshi Sakurai wrote in news:dep4oc$8sq$1@digitaldaemon.com [...] > _READ_LINE: > foreach (char [] line; stream) { [...] > continue _READ_LINE; [...] specs: | If continue is followed by Identifier, the Identifier must be | the label of an enclosing while, for, or do loop, and the next | iteration of that loop is executed. It is an error if there is | no such statement. What does the "it is an error" mean? - It is an error but may not be reported by the compiler. - It is illegal. -manfred |
August 27, 2005 Re: continue with the label in foreach | ||||
---|---|---|---|---|
| ||||
Posted in reply to Manfred Nowak | In article <depc5a$goo$1@digitaldaemon.com>, Manfred Nowak says... > >Hiroshi Sakurai wrote in news:dep4oc$8sq$1@digitaldaemon.com > >[...] >> _READ_LINE: >> foreach (char [] line; stream) { >[...] >> continue _READ_LINE; >[...] > >specs: >| If continue is followed by Identifier, the Identifier must be >| the label of an enclosing while, for, or do loop, and the next >| iteration of that loop is executed. It is an error if there is >| no such statement. > >What does the "it is an error" mean? >- It is an error but may not be reported by the compiler. >- It is illegal. > >-manfred Oh. Continue statements in foreach is not in the spec. umumumumumu... Please write that Continue Statement in foreach can be used for the specification. I think "this is natural". -sakurai |
August 27, 2005 Re: continue with the label in foreach | ||||
---|---|---|---|---|
| ||||
Posted in reply to Manfred Nowak | Manfred Nowak wrote:
> Hiroshi Sakurai wrote in news:dep4oc$8sq$1@digitaldaemon.com
>
> [...]
>
>>_READ_LINE:
>>foreach (char [] line; stream) {
>
> [...]
>
>>continue _READ_LINE;
>
> [...]
>
> specs:
> | If continue is followed by Identifier, the Identifier must be
> | the label of an enclosing while, for, or do loop, and the next
> | iteration of that loop is executed. It is an error if there is
> | no such statement.
>
> What does the "it is an error" mean?
> - It is an error but may not be reported by the compiler.
> - It is illegal.
>
> -manfred
However, the fact that it crashed the compiler with an "internal error" still makes it a noteworthy bug.
|
August 27, 2005 Re: continue with the label in foreach | ||||
---|---|---|---|---|
| ||||
Posted in reply to Manfred Nowak | In article <depc5a$goo$1@digitaldaemon.com>, Manfred Nowak says... > >Hiroshi Sakurai wrote in news:dep4oc$8sq$1@digitaldaemon.com > >[...] >> _READ_LINE: >> foreach (char [] line; stream) { >[...] >> continue _READ_LINE; >[...] > >specs: >| If continue is followed by Identifier, the Identifier must be >| the label of an enclosing while, for, or do loop, and the next >| iteration of that loop is executed. It is an error if there is >| no such statement. > >What does the "it is an error" mean? >- It is an error but may not be reported by the compiler. >- It is illegal. > >-manfred It is an error to use a non-existent label following continue, and it is reported by the compiler, but that really is off-topic. As to the original post, it is a compiler bug. If you 'typedef char[][] Stream' then the code compiles fine. It appears that UDT's having an opApply will crash the compiler just as the OP said. - Dave |
August 27, 2005 Re: continue with the label in foreach | ||||
---|---|---|---|---|
| ||||
Posted in reply to Hiroshi Sakurai Attachments: | Hiroshi Sakurai schrieb: > In article <depc5a$goo$1@digitaldaemon.com>, Manfred Nowak says... > >>Hiroshi Sakurai wrote in news:dep4oc$8sq$1@digitaldaemon.com >> >>[...] >> >>>_READ_LINE: >>>foreach (char [] line; stream) { >> >>[...] >> >>>continue _READ_LINE; >> >>[...] >> >>specs: >>| If continue is followed by Identifier, the Identifier must be >>| the label of an enclosing while, for, or do loop, and the next >>| iteration of that loop is executed. It is an error if there is >>| no such statement. >> >>What does the "it is an error" mean? >>- It is an error but may not be reported by the compiler. >>- It is illegal. >> >>-manfred > > > Oh. Continue statements in foreach is not in the spec. umumumumumu... Added to DStress as http://dstress.kuehne.cn/nocompile/c/continue_01.d http://dstress.kuehne.cn/nocompile/c/continue_02.d http://dstress.kuehne.cn/nocompile/c/continue_03_A.d http://dstress.kuehne.cn/nocompile/c/continue_03_B.d Thomas |
Copyright © 1999-2021 by the D Language Foundation