mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[cxx-interop] Do not import partial specializations of variables
They do not get imported correctly and trigger linker errors. rdar://149232900 / resolves https://github.com/swiftlang/swift/issues/80802
This commit is contained in:
@@ -4638,6 +4638,11 @@ namespace {
|
||||
return result;
|
||||
}
|
||||
|
||||
Decl *VisitVarTemplatePartialSpecializationDecl(
|
||||
const clang::VarTemplatePartialSpecializationDecl *decl) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Decl *VisitImplicitParamDecl(const clang::ImplicitParamDecl *decl) {
|
||||
// Parameters are never directly imported.
|
||||
return nullptr;
|
||||
|
||||
@@ -55,9 +55,6 @@ func foo() {
|
||||
|
||||
print(MyClass().class_const_int)
|
||||
print(MyClass.class_static_const_int)
|
||||
|
||||
// TODO: This seems to be incorrectly imported, this test here is just to check that the compiler doesn't crash.
|
||||
print(template_gcd)
|
||||
}
|
||||
|
||||
// Only imported as external declarations:
|
||||
|
||||
@@ -177,3 +177,8 @@ module UninstantiatableSpecialMembers {
|
||||
header "uninstantiatable-special-members.h"
|
||||
requires cplusplus
|
||||
}
|
||||
|
||||
module VariableTemplate {
|
||||
header "variable-template.h"
|
||||
requires cplusplus
|
||||
}
|
||||
|
||||
5
test/Interop/Cxx/templates/Inputs/variable-template.h
Normal file
5
test/Interop/Cxx/templates/Inputs/variable-template.h
Normal file
@@ -0,0 +1,5 @@
|
||||
template <int N, int M>
|
||||
inline const int template_gcd = template_gcd<M, N % M>;
|
||||
|
||||
template <int N>
|
||||
inline const int template_gcd<N, 0> = N;
|
||||
@@ -0,0 +1,5 @@
|
||||
// RUN: %target-typecheck-verify-swift -cxx-interoperability-mode=default -I %S/Inputs
|
||||
|
||||
import VariableTemplate
|
||||
|
||||
let _: CInt = template_gcd // expected-error {{cannot find 'template_gcd' in scope}}
|
||||
Reference in New Issue
Block a user