From 7b826ec80c4e6ed65595cf6d3a7978e12b31ccad Mon Sep 17 00:00:00 2001 From: "Harry T. Vennik" Date: Mon, 5 Jun 2017 13:39:56 +0200 Subject: [PATCH 1/2] Return correct typecode for tuple --- source/ddbus/util.d | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/source/ddbus/util.d b/source/ddbus/util.d index 6bdaa4f..65f74d8 100644 --- a/source/ddbus/util.d +++ b/source/ddbus/util.d @@ -143,8 +143,10 @@ string[] typeSigArr(TS...)() if(allCanDBus!TS) { } int typeCode(T)() if(canDBus!T) { - string sig = typeSig!T(); - return sig[0]; + static if (isTuple!T) + return 'r'; + else + return typeSig!T()[0]; } unittest { From 227d0085ca50ca0a70e7a9c3959caf8e87f1c6e8 Mon Sep 17 00:00:00 2001 From: "Harry T. Vennik" Date: Tue, 6 Jun 2017 07:10:11 +0200 Subject: [PATCH 2/2] Add check for correct typecode for tuple to unittest --- source/ddbus/util.d | 1 + 1 file changed, 1 insertion(+) diff --git a/source/ddbus/util.d b/source/ddbus/util.d index 65f74d8..106cc89 100644 --- a/source/ddbus/util.d +++ b/source/ddbus/util.d @@ -171,6 +171,7 @@ unittest { // type codes typeCode!int().assertEqual(cast(int)('i')); typeCode!bool().assertEqual(cast(int)('b')); + typeCode!(Tuple!(int, string))().assertEqual(cast(int)('r')); // ctfe-capable static string sig = typeSig!ulong(); sig.assertEqual("t");