diff options
Diffstat (limited to 'source/slang/slang-check-overload.cpp')
| -rw-r--r-- | source/slang/slang-check-overload.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/source/slang/slang-check-overload.cpp b/source/slang/slang-check-overload.cpp index 8d76d2554..7a89f2e23 100644 --- a/source/slang/slang-check-overload.cpp +++ b/source/slang/slang-check-overload.cpp @@ -1328,6 +1328,20 @@ int SemanticsVisitor::CompareLookupResultItems( bool rightIsExtension = false; bool leftIsFreeFormExtension = false; bool rightIsFreeFormExtension = false; + bool leftIsExtern = left.declRef.getDecl()->hasModifier<ExternModifier>(); + bool rigthIsExtern = right.declRef.getDecl()->hasModifier<ExternModifier>(); + + // If both left and right are extern, then they are equal. + // If only one of them is extern, then the other one is preferred. + // If neither is extern, then we continue with the rest of the checks. + if (leftIsExtern) + { + return (rigthIsExtern ? 0 : 1); + } + if (rigthIsExtern) + { + return (leftIsExtern ? -1 : 0); + } // Prefer declarations that are not in free-form generic extensions, i.e. // `extension<T:IFoo> T { /* declaration here should have lower precedence. */ } |
