Skip to content

Commit 6061d46

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 b7c4ef4 commit 6061d46

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
@@ -2633,9 +2633,11 @@ static ParamDecl *getParameterInfo(ClangImporter::Implementation *impl,
26332633
// Swift doesn't support default values of inout parameters.
26342634
// TODO: support default arguments of constructors
26352635
// (https://github.com/apple/swift/issues/70124)
2636+
// TODO: support params with template parameters
26362637
if (param->hasDefaultArg() && !isInOut &&
26372638
!isa<clang::CXXConstructorDecl>(param->getDeclContext()) &&
2638-
impl->isDefaultArgSafeToImport(param)) {
2639+
impl->isDefaultArgSafeToImport(param) &&
2640+
!param->isTemplated()) {
26392641
SwiftDeclSynthesizer synthesizer(*impl);
26402642
if (CallExpr *defaultArgExpr = synthesizer.makeDefaultArgument(
26412643
param, swiftParamTy, paramInfo->getParameterNameLoc())) {

0 commit comments

Comments
 (0)