summaryrefslogtreecommitdiffstats
path: root/source/slang/slang-check-conversion.cpp
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2022-04-12 15:23:53 -0700
committerGitHub <noreply@github.com>2022-04-12 15:23:53 -0700
commit65c2e7f1ccc6cdb5daec343c7e32b4a9dc463ae4 (patch)
treeb13a93f5fa621a50ce3c100f018730c882ca3e9c /source/slang/slang-check-conversion.cpp
parent89560d62f3fb42e0f76cbae76c23eac437b65eba (diff)
Support `[DllImport]` (#2181)
* Support `[DllImport]` * Fix. * Fix. * Fix array type emit in cpp. * Fix. * Fix. * Fix Co-authored-by: Yong He <yhe@nvidia.com>
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.
//