Skip to content

Standard Library Modules: error C2039: 'promise_type': is not a member of 'std::coroutine_traits<TestModule::FireAndForget>' #4826

@StephanTLavavej

Description

@StephanTLavavej

Repros with VS 2022 17.11 Preview 3. Reported by CppMan on Discord.

I'm not familiar enough with coroutines, or with multiple module scenarios, to say what should happen when a module tries to export a partial specialization like std::coroutine_traits<TestModule::FireAndForget, Ts...>.

C:\Temp>type meow.ixx
export module Module;

import std;

export namespace TestModule {
    struct FireAndForget {};
} // namespace TestModule

export template <typename... Ts>
struct std::coroutine_traits<TestModule::FireAndForget, Ts...> {
    struct promise_type {
        TestModule::FireAndForget get_return_object() const noexcept {
            return {};
        }

        void return_void() const noexcept {}

        std::suspend_never initial_suspend() const noexcept {
            return {};
        }

        std::suspend_never final_suspend() const noexcept {
            return {};
        }

        void unhandled_exception() const noexcept {}
    };
};
C:\Temp>type test.cpp
import Module;
import std;

TestModule::FireAndForget Test() {
    co_return;
}

int main() {
    Test();
}
C:\Temp>cl /EHsc /nologo /W4 /std:c++latest /MTd /Od /c "%VCToolsInstallDir%\modules\std.ixx"
std.ixx

C:\Temp>cl /EHsc /nologo /W4 /std:c++latest /MTd /Od /c meow.ixx
meow.ixx

C:\Temp>cl /EHsc /nologo /W4 /std:c++latest /MTd /Od test.cpp meow.obj std.obj
test.cpp
test.cpp(5): error C2039: 'promise_type': is not a member of 'std::coroutine_traits<TestModule::FireAndForget>'
C:\Program Files\Microsoft Visual Studio\2022\Preview\VC\Tools\MSVC\14.41.34021\include\coroutine(46): note: see declaration of 'std::coroutine_traits<TestModule::FireAndForget>'

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingcompilerCompiler work involvedmodulesC++23 modules, C++20 header unitsresolvedSuccessfully resolved without a commit

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions