Skip to content

Commit bb792b3

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 615f3b9 commit bb792b3

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
@@ -2656,9 +2656,11 @@ static ParamDecl *getParameterInfo(ClangImporter::Implementation *impl,
26562656
// Swift doesn't support default values of inout parameters.
26572657
// TODO: support default arguments of constructors
26582658
// (https://github.com/apple/swift/issues/70124)
2659+
// TODO: support params with template parameters
26592660
if (param->hasDefaultArg() && !isInOut &&
26602661
!isa<clang::CXXConstructorDecl>(param->getDeclContext()) &&
2661-
impl->isDefaultArgSafeToImport(param)) {
2662+
impl->isDefaultArgSafeToImport(param) &&
2663+
!isa<clang::FunctionTemplateDecl>(param->getDeclContext())) {
26622664
SwiftDeclSynthesizer synthesizer(*impl);
26632665
if (CallExpr *defaultArgExpr = synthesizer.makeDefaultArgument(
26642666
param, swiftParamTy, paramInfo->getParameterNameLoc())) {

0 commit comments

Comments
 (0)