Bug 2456 – "cannot put catch statement inside finally block", missing line number
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
x86
OS
All
Creation time
2008-11-15T08:51:00Z
Last change time
2015-06-09T05:11:52Z
Keywords
diagnostic, pull, rejects-valid
Assigned to
nobody
Creator
fvbommel
Comments
Comment #0 by fvbommel — 2008-11-15T08:51:35Z
I get an error ("cannot put catch statement inside finally block") on the following code:
----
module test;
extern(C) int printf(char*, ...);
void verify() {}
void main() {
scope(success) {
scope(failure)
printf("Verification failed!\n");
verify();
}
}
----
(GDC allows this without complaining)
Also, this error doesn't print a source location.
Comment #1 by acehreli — 2011-11-03T14:29:20Z
I hit the same problem with dmd 2.056. Here is a simpler code:
void main()
{
scope(exit) try{} catch {}
}
Notes:
1) In this case the line number is printed correctly in the error message.
2) It is the same issue with scope(success)
Comment #2 by acehreli — 2011-11-03T14:31:47Z
Please disregard my previous comment. I am talking about something else.
Comment #3 by clugdbug — 2012-09-26T01:30:46Z
Applies also to D2.060. Has no line number in the error message in D1 or D2.