summaryrefslogtreecommitdiff
path: root/source/slang/slang-check-conversion.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'source/slang/slang-check-conversion.cpp')
-rw-r--r--source/slang/slang-check-conversion.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/source/slang/slang-check-conversion.cpp b/source/slang/slang-check-conversion.cpp
index 855590472..a1935d65c 100644
--- a/source/slang/slang-check-conversion.cpp
+++ b/source/slang/slang-check-conversion.cpp
@@ -753,6 +753,18 @@ namespace Slang
return true;
}
+ // nullptr_t can be cast into any pointer type.
+ if (as<NullPtrType>(fromType) && as<PtrType>(toType))
+ {
+ if (outCost)
+ {
+ *outCost = kConversionCost_None;
+ }
+ if (outToExpr)
+ *outToExpr = fromExpr;
+ return true;
+ }
+
// If we are casting to an interface type, then that will succeed
// if the "from" type conforms to the interface.
//