Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

Coroutines: error when non-copyable/non-movable returned from `await_resume`

Đang mở
#14,244 1 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
35/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
cpp
Lĩnh vực
devtools

Hướng nghiên cứu

Bắt đầu bằng cách tái hiện báo cáo trong main.cpp với C++20 và cấu hình Windows MSVC IntelliSense được mô tả. Theo dõi chẩn đoán tại biểu thức co_await khi await_resume trả về foo không thể sao chép; được xem là hoàn tất khi IntelliSense không báo dấu gạch chân lượn sóng lỗi nào trong khi các trình biên dịch được liệt kê vẫn tiếp tục chấp nhận mã.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

bug Language Service parser Visual Studio
Environment
  • OS and Version: Windows 11 25H2
  • VS Code Version: 1.110.0
  • C/C++ Extension Version: 1.30.5
  • If using SSH remote, specify OS of remote machine: None

When returning a non-copyable and non-movable value from await_resume of an awaiter, intellisense reports this error at the co_await point (using MSVC as compiler): function "foo::foo(foo &&)" cannot be referenced -- it is a deleted function.

Nevertheless, MSVC, GCC and Clang accept the code and the program behaves as expected.

Bug Summary and Steps to Reproduce

Bug Summary:

Steps to reproduce: Paste the following snippet:

#include <coroutine>
#include <exception>

struct fire_and_forget final
{
    struct promise_type;
};

struct fire_and_forget::promise_type final
{
    static constexpr fire_and_forget get_return_object() noexcept { return {}; }
    static constexpr std::suspend_never initial_suspend() noexcept { return {}; }
    static constexpr std::suspend_never final_suspend() noexcept { return {}; }

    static constexpr void return_void() noexcept {}
    inline static void unhandled_exception() noexcept { std::terminate(); }
};


struct foo final
{
    foo() = default;

    foo(foo const &) = delete;
    foo &operator=(foo const &) = delete;

    foo(foo &&) = delete;
    foo &operator=(foo &&) = delete;
};

struct my_awaiter final
{
    bool await_ready() { return false; }
    void await_suspend(auto) {}
    foo await_resume() { return foo{}; }
};

fire_and_forget test()
{
    auto x = co_await my_awaiter{}; // error here
}

Expected behavior: No error squiggles

Configuration and Logs
// c_cpp_properties.json

{
    "configurations": [
        {
            "name": "Win32",
            "includePath": [
                "${workspaceFolder}/**",
                "${workspaceFolder}/src"
            ],
            "defines": [
                "_DEBUG",
                "UNICODE",
                "_UNICODE"
            ],
            "windowsSdkVersion": "10.0.26100.0",
            "intelliSenseMode": "windows-msvc-x64"
        }
    ],
    "version": 4
}

C/C++: Log Diagnostics

-------- Diagnostics - 3/5/2026, 12:04:00 PM
Version: 1.30.5
Current Configuration:
{
    "name": "Win32",
    "includePath": [
        "<User>/thing/cpp/entt_scheduler_demo/**",
        "<User>/thing/cpp/entt_scheduler_demo/src"
    ],
    "defines": [
        "_DEBUG",
        "UNICODE",
        "_UNICODE"
    ],
    "windowsSdkVersion": "10.0.26100.0",
    "intelliSenseMode": "windows-msvc-x64",
    "compilerPathIsExplicit": true,
    "cStandardIsExplicit": true,
    "cppStandardIsExplicit": true,
    "intelliSenseModeIsExplicit": true,
    "recursiveIncludesReduceIsExplicit": false,
    "recursiveIncludesPriorityIsExplicit": false,
    "recursiveIncludesOrderIsExplicit": false,
    "cStandard": "c17",
    "cppStandard": "c++20",
    "mergeConfigurations": false,
    "recursiveIncludes": {},
    "compilerPath": "${env:CXX}",
    "browse": {
        "limitSymbolsToIncludedHeaders": true
    }
}
Modified Settings:
{
    "C_Cpp.inlayHints.autoDeclarationTypes.enabled": true,
    "C_Cpp.inlayHints.parameterNames.enabled": true,
    "C_Cpp.autocompleteAddParentheses": true,
    "C_Cpp.errorSquiggles": "enabled",
    "C_Cpp.default.compilerPath": "${env:CXX}",
    "C_Cpp.default.cStandard": "c17",
    "C_Cpp.default.cppStandard": "c++20",
    "C_Cpp.commentContinuationPatterns": [
        "/*"
    ],
    "C_Cpp.codeAnalysis.clangTidy.enabled": true,
    "C_Cpp.codeAnalysis.clangTidy.args": [
        "-isystem=CMakeLists.txt",
        "*"
    ],
    "C_Cpp.codeAnalysis.clangTidy.checks.disabled": [
        "cppcoreguidelines-avoid-magic-numbers",
        "cppcoreguidelines-avoid-c-arrays",
        "fuchsia-default-arguments-calls",
        "fuchsia-default-arguments-declarations",
        "fuchsia-overloaded-operator",
        "hicpp-avoid-c-arrays",
        "llvm-include-order",
        "llvm-header-guard",
        "llvmlibc-*",
        "modernize-avoid-c-arrays",
        "readability-magic-numbers"
    ],
    "C_Cpp.experimentalFeatures": "enabled"
}
Additional Tracked Settings:
{
    "editorTabSize": 4,
    "editorInsertSpaces": true,
    "editorAutoClosingBrackets": "languageDefined",
    "filesEncoding": "utf8",
    "filesAssociations": {},
    "filesExclude": {
        "**/.git": true,
        "**/.svn": true,
        "**/.hg": true,
        "**/.DS_Store": true,
        "**/Thumbs.db": true
    },
    "filesAutoSaveAfterDelay": false,
    "editorInlayHintsEnabled": true,
    "editorParameterHintsEnabled": true,
    "searchExclude": {
        "**/node_modules": true,
        "**/bower_components": true,
        "**/*.code-search": true
    },
    "workbenchSettingsEditor": "ui"
}
cpptools version (native): 1.30.5.0
Current database path: <User>\APPDATA\LOCAL\MICROSOFT\VSCODE-CPPTOOLS\8867B49488CF20A004321616C2AF107D\.BROWSE.VC.DB
Translation Unit Mappings:
[ <User>\thing\cpp\entt_scheduler_demo\main.cpp - source TU]:
Translation Unit Configurations:
[ <User>\thing\cpp\entt_scheduler_demo\main.cpp ]
    Process ID: 25624
    Memory Usage: 85 MB
    Compiler Path: C:\Program Files\Microsoft Visual Studio\18\Community\VC\Tools\MSVC\14.50.35717\bin\Hostx64\x64\cl.exe
    Include paths:
        include: <User>\thing\cpp\entt_scheduler_demo\src
        system include: C:\Program Files\Microsoft Visual Studio\18\Community\VC\Tools\MSVC\14.50.35717\include
        system include: C:\Program Files\Microsoft Visual Studio\18\Community\VC\Tools\MSVC\14.50.35717\atlmfc\include
        system include: C:\Program Files (x86)\Windows Kits\10\Include\10.0.26100.0\um
        system include: C:\Program Files (x86)\Windows Kits\10\Include\10.0.26100.0\ucrt
        system include: C:\Program Files (x86)\Windows Kits\10\Include\10.0.26100.0\shared
        system include: C:\Program Files (x86)\Windows Kits\10\Include\10.0.26100.0\winrt
        system include: C:\Program Files (x86)\Windows Kits\10\Include\10.0.26100.0\cppwinrt
    Defines:
        _DEBUG
        UNICODE
        _UNICODE
    Standard Version: ms_c++20
    IntelliSense Mode: windows-msvc-x64
Total Memory Usage: 85 MB

------- Workspace parsing diagnostics -------
Number of files discovered (not excluded): 5892
Other Extensions

No response

Additional context

No response

Ngôn ngữ chính
TypeScript
Star
6.2k
Fork
1.7k
Merge trung bình
1 ngày 4 giờ
Pull request đã merge (30 ngày)
58

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của microsoft/vscode-cpptools

Tất cả issue của microsoft/vscode-cpptools

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.