summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorEugen Wissner <belka@caraus.de>2018-03-25 09:19:35 +0200
committerEugen Wissner <belka@caraus.de>2018-03-25 09:19:35 +0200
commit9fb043ba6503315ccf7de240f1b635f94f503bb2 (patch)
treed3edb6cdae64d524ae2cb18aadbc57917b08fc1b /source
parent162db622ead425b92e55cffc9dc06eff75d9a888 (diff)
downloadtanya-9fb043ba6503315ccf7de240f1b635f94f503bb2.tar.gz
Fix typeof(null) being a pointer for isPointer
Diffstat (limited to 'source')
-rw-r--r--source/tanya/meta/package.d2
-rw-r--r--source/tanya/meta/trait.d15
-rw-r--r--source/tanya/meta/transform.d2
3 files changed, 16 insertions, 3 deletions
diff --git a/source/tanya/meta/package.d b/source/tanya/meta/package.d
index 568a24f..d93e4fa 100644
--- a/source/tanya/meta/package.d
+++ b/source/tanya/meta/package.d
@@ -9,7 +9,7 @@
* to transform from one type to another. It has also different algorithms for
* iterating, searching and modifying template arguments.
*
- * Copyright: Eugene Wissner 2017.
+ * Copyright: Eugene Wissner 2017-2018.
* License: $(LINK2 https://www.mozilla.org/en-US/MPL/2.0/,
* Mozilla Public License, v. 2.0).
* Authors: $(LINK2 mailto:info@caraus.de, Eugene Wissner)
diff --git a/source/tanya/meta/trait.d b/source/tanya/meta/trait.d
index f62b19a..53f488e 100644
--- a/source/tanya/meta/trait.d
+++ b/source/tanya/meta/trait.d
@@ -735,7 +735,7 @@ template isPointer(T)
{
static if (is(T U : U*))
{
- enum bool isPointer = true;
+ enum bool isPointer = !is(Unqual!(OriginalType!T) == typeof(null));
}
else
{
@@ -752,6 +752,19 @@ template isPointer(T)
static assert(!isPointer!bool);
}
+// typeof(null) is not a pointer.
+@nogc nothrow pure @safe unittest
+{
+ static assert(!isPointer!(typeof(null)));
+ static assert(!isPointer!(const shared typeof(null)));
+
+ enum typeOfNull : typeof(null)
+ {
+ null_ = null,
+ }
+ static assert(!isPointer!typeOfNull);
+}
+
/**
* Determines whether $(D_PARAM T) is an array type (dynamic or static, but
* not an associative one).
diff --git a/source/tanya/meta/transform.d b/source/tanya/meta/transform.d
index 5d4a50b..7d6170d 100644
--- a/source/tanya/meta/transform.d
+++ b/source/tanya/meta/transform.d
@@ -9,7 +9,7 @@
* types. They take some type as argument and return a different type after
* perfoming the specified transformation.
*
- * Copyright: Eugene Wissner 2017.
+ * Copyright: Eugene Wissner 2017-2018.
* License: $(LINK2 https://www.mozilla.org/en-US/MPL/2.0/,
* Mozilla Public License, v. 2.0).
* Authors: $(LINK2 mailto:info@caraus.de, Eugene Wissner)