Bug 13217 – nothrow, template function and delegate: compilation error

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2014-07-27T18:47:00Z
Last change time
2014-08-10T12:54:45Z
Assigned to
nobody
Creator
villytiger

Comments

Comment #0 by villytiger — 2014-07-27T18:47:17Z
$ 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
Comment #1 by github-bugzilla — 2014-08-10T12:54:44Z
Commit pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/301658634a9d6cf2542b613850774a077391bf6d fix Issue 13217 - nothrow, template function and delegate: compilation error