Fix typeof(null) being a pointer for isPointer
This commit is contained in:
parent
162db622ea
commit
9fb043ba65
source/tanya/meta
@ -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)
|
||||
|
@ -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).
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user