www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - continue with the label in foreach

reply Hiroshi Sakurai <Hiroshi_member pathlink.com> writes:
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.
Aug 27 2005
parent reply Manfred Nowak <svv1999 hotmail.com> writes:
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
Aug 27 2005
next sibling parent reply Hiroshi Sakurai <Hiroshi_member pathlink.com> writes:
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
Aug 27 2005
parent =?UTF-8?B?VGhvbWFzIEvDvGhuZQ==?= <thomas-dloop kuehne.cn> writes:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

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 -----BEGIN PGP SIGNATURE----- iD8DBQFDEJA53w+/yD4P9tIRAiqlAKDArPOZBWSN0JjQJXIEXIXwESW0HwCbBfUv NtBE2YYgbsurxNkwK3cj4sk= =KACH -----END PGP SIGNATURE-----
Aug 27 2005
prev sibling next sibling parent Deewiant <deewiant.doesnotlike.spam gmail.com> writes:
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.
Aug 27 2005
prev sibling parent Dave <Dave_member pathlink.com> writes:
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
Aug 27 2005