Skip to content

Commit 7dc3070

Browse files
committed
C++Interop: Don't create default argument expressions that are templated
SwiftDeclSynthesizer::makeDefaultArgument does not create substituion map while creating the implicit FuncDecl which leads to TypeChecker complaining about the absence when there are type parameters. Avoid importing such C++ functions for now.
1 parent c60a067 commit 7dc3070

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lib/ClangImporter/ImportType.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2657,9 +2657,11 @@ static ParamDecl *getParameterInfo(ClangImporter::Implementation *impl,
26572657
// Swift doesn't support default values of inout parameters.
26582658
// TODO: support default arguments of constructors
26592659
// (https://github.com/apple/swift/issues/70124)
2660+
// TODO: support params with template parameters
26602661
if (param->hasDefaultArg() && !isInOut &&
26612662
!isa<clang::CXXConstructorDecl>(param->getDeclContext()) &&
2662-
impl->isDefaultArgSafeToImport(param)) {
2663+
impl->isDefaultArgSafeToImport(param) &&
2664+
!isa<clang::FunctionTemplateDecl>(param->getDeclContext())) {
26632665
SwiftDeclSynthesizer synthesizer(*impl);
26642666
if (CallExpr *defaultArgExpr = synthesizer.makeDefaultArgument(
26652667
param, swiftParamTy, paramInfo->getParameterNameLoc())) {

0 commit comments

Comments
 (0)