From c6b9a91253bce6d450efc281b3f86617b3eef633 Mon Sep 17 00:00:00 2001 From: kaizhangNV <149626564+kaizhangNV@users.noreply.github.com> Date: Tue, 23 Apr 2024 18:39:15 -0700 Subject: Do not diagnose error when a symbols is defined as 'extern' and 'export' (#4010) Fix the issue (#3999). For a function is defined as extern and export at the same time, don't report error, we can use the 'export' function to overload the 'extern' function. --- source/slang/slang-check-decl.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'source/slang/slang-check-decl.cpp') diff --git a/source/slang/slang-check-decl.cpp b/source/slang/slang-check-decl.cpp index 17551912d..cb68dced9 100644 --- a/source/slang/slang-check-decl.cpp +++ b/source/slang/slang-check-decl.cpp @@ -6944,6 +6944,13 @@ namespace Slang if (!doFunctionSignaturesMatch(newDeclRef, oldDeclRef)) return SLANG_OK; + // If the declatation is declared by 'extern', and new definition is with 'export', then + // we should let overload resolution to handle it. + if (oldDecl->hasModifier() && newDecl->hasModifier()) + { + return SLANG_OK; + } + // If we get this far, then we've got two declarations in the same // scope, with the same name and signature, so they appear // to be redeclarations. -- cgit v1.2.3