Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Re-exporting a module in a modulemap does not work #80216

Open
Steelskin opened this issue Mar 21, 2025 · 0 comments
Open

Re-exporting a module in a modulemap does not work #80216

Steelskin opened this issue Mar 21, 2025 · 0 comments
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. triage needed This issue needs more specific labels

Comments

@Steelskin
Copy link
Contributor

Description

Consider the following modulemap file:

module Interop {
    header "interop.h"
    requires cplusplus
}

module Container {
    export Interop
}

The modulemap documentation states that:

An export-declaration specifies which imported modules will automatically be re-exported as part of a given module’s API.

However, when importing Container in Swift, the symbols defined in interop.h are not available.

Reproduction

// ImportInterop.swift
import Container

var result = InteropClass();
result.property = true;
// interop/interop.h
#pragma once

class InteropClass {
public:
    bool property = false;
};
// interop/module.modulemap
module Interop {
    header "interop.h"
    requires cplusplus
}

module Container {
    export Interop
}

Build command:

swiftc -v -module-cache-path clang-module-cache/ -Xfrontend -cxx-interoperability-mode=default -I interop/ -c ImportInterop.swift -o ImportInterop.o

Expected behavior

The above code should compile properly. InteropClass should be a valid symbol.

Environment

Swift 6.1-dev (recent-ish trunk build)

Additional information

No response

@Steelskin Steelskin added bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. triage needed This issue needs more specific labels labels Mar 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. triage needed This issue needs more specific labels
Projects
None yet
Development

No branches or pull requests

1 participant