From 2f0c75f72ef151327b8dd852974eb34671036df0 Mon Sep 17 00:00:00 2001 From: Kiith-Sa Date: Wed, 16 Oct 2013 23:14:02 +0200 Subject: [PATCH] Nothrow Node opAssign. --- source/dyaml/node.d | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/source/dyaml/node.d b/source/dyaml/node.d index 47cd921..6b2599f 100644 --- a/source/dyaml/node.d +++ b/source/dyaml/node.d @@ -160,13 +160,13 @@ struct Node } /// Assignment (shallow copy) by value. - void opAssign(Pair rhs) @safe + void opAssign(Pair rhs) @safe nothrow { opAssign(rhs); } /// Assignment (shallow copy) by reference. - void opAssign(ref Pair rhs) @safe + void opAssign(ref Pair rhs) @safe nothrow { key = rhs.key; value = rhs.value; @@ -892,15 +892,17 @@ struct Node } /// Assignment (shallow copy) by value. - void opAssign(Node rhs) @safe + void opAssign(Node rhs) @safe nothrow { opAssign(rhs); } /// Assignment (shallow copy) by reference. - void opAssign(ref Node rhs) @safe + void opAssign(ref Node rhs) @trusted nothrow { - value_ = rhs.value_; + // Value opAssign doesn't really throw, so force it to nothrow. + alias Value delegate(Value) nothrow valueAssignNothrow; + (cast(valueAssignNothrow)&value_.opAssign!Value)(rhs.value_); startMark_ = rhs.startMark_; tag_ = rhs.tag_; scalarStyle = rhs.scalarStyle;