If change 'finally' to 'finally1' in both places, it compiles and runs.
Why does 'finally' break compilation?
Is this a BUG or a FEATURE?
From: Programming in D book, page 511.
Error:
c:\dev\D\71 - 80\c76_1c_c_style_code_not_needed_in_D\source\app.d(12): Error: identifier expected following `goto`
goto finally;
^
c:\dev\D\71 - 80\c76_1c_c_style_code_not_needed_in_D\source\app.d(12): Error: found `finally` when expecting `;` following `goto` statement
goto finally;
^
c:\dev\D\71 - 80\c76_1c_c_style_code_not_needed_in_D\source\app.d(17): Error: found `finally` instead of statement
finally:
^
source/app.d
import std.stdio;
void main() {
writeln("foo() is: ", foo());
}
// --- C code --
int foo() {
int error = 42;
if (error) {
goto finally;
}
error = 86;
finally:
// ... cleanup operations ...
return error;
}