KEMBAR78
defining struct/class code and finishing impl later in an export { } block · Issue #61890 · llvm/llvm-project · GitHub
Skip to content

defining struct/class code and finishing impl later in an export { } block #61890

@ar-visions

Description

@ar-visions
module;

export module test_mod;

export {
struct test_me {
    void test_method();
};

void test_me::test_method() { /// fatal error: cannot export 'test_method' as it is not at namespace scope [?]
    printf("test");
}
}

// this works:
module;

export module test_mod;

export struct test_me {
    void test_method();
};

void test_me::test_method() { /// works.
    printf("test");
}


// this also works:
module;

export module test_mod;

export {
struct test_me {
    void test_method();
};
}

void test_me::test_method() { /// works.
    printf("test");
}

version / target:

clang version 17.0.0 (https://github.com/llvm/llvm-project f66b9fe5876d670b38351c9a7efd90e793f35a30)
Target: arm64-apple-darwin22.3.0

my issue:
...putting it all in export { } works on MSVC. its declared exported above and finished inside. What namespace would it be referring to? if the export { } creates the namespace its certainly inside it in the error case?

Metadata

Metadata

Assignees

No one assigned

    Labels

    clang:modulesC++20 modules and Clang Header ModuleswontfixIssue is real, but we can't or won't fix it. Not invalid

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions