Skip to content

Add support for default arguments in C++ function templates #83152

@maddyadams

Description

@maddyadams

Description

Swift supports omitting default arguments when calling C++ functions in most circumstances, but not when the function being called is a function template

Reproduction

template <typename T>
void foo(T t, double x = 0) {}
foo(3 as CInt) // Error: Missing argument for parameter #2 in call

Expected behavior

I expected the code would compile

Environment

swift-driver version: 1.120.5 Apple Swift version 6.1 (swiftlang-6.1.0.110.21 clang-1700.0.13.3)
Target: arm64-apple-macosx15.0

Additional information

rdar://136703069

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.triage neededThis issue needs more specific labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions