From 65c2e7f1ccc6cdb5daec343c7e32b4a9dc463ae4 Mon Sep 17 00:00:00 2001 From: Yong He Date: Tue, 12 Apr 2022 15:23:53 -0700 Subject: Support `[DllImport]` (#2181) * Support `[DllImport]` * Fix. * Fix. * Fix array type emit in cpp. * Fix. * Fix. * Fix Co-authored-by: Yong He --- source/slang/slang-check-conversion.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'source/slang/slang-check-conversion.cpp') 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(fromType) && as(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. // -- cgit v1.2.3