[Issue 13217] New: nothrow, template function and delegate: compilation error
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Sun Jul 27 11:47:17 PDT 2014
https://issues.dlang.org/show_bug.cgi?id=13217
Issue ID: 13217
Summary: nothrow, template function and delegate: compilation
error
Product: D
Version: D2
Hardware: x86_64
OS: Linux
Status: NEW
Severity: normal
Priority: P1
Component: DMD
Assignee: nobody at puremagic.com
Reporter: villytiger at gmail.com
$ cat main.d
import std.stdio;
nothrow void a(T)(T x) {
try {
() {
writeln("a");
} ();
} catch(Exception e) {
}
}
void main() {
a(1);
}
$ dmd main.d
main.d(6): Error: 'std.stdio.writeln!(string).writeln' is not nothrow
main.d(5): Error: delegate 'main.a!int.a.__lambda2' is nothrow yet may throw
main.d(13): Error: template instance main.a!int error instantiating
Any of the following actions remove error:
- moving nothrow to the end of function declaration
- making function without template
- calling writeln directly without delegate
$ cat main.d
import std.stdio;
void a() nothrow {
try {
writeln("a");
} catch(Exception e) {
}
}
void main() {
a();
}
$ dmd main.d
$ echo $?
0
--
More information about the Digitalmars-d-bugs
mailing list