Skip to content

main does not compile under MSVC: #1054 removed a lambda capture that was not redundant #1068

Description

@localai-bot

main does not compile under MSVC since e34d71379 (PR #1054, landed
2026-08-16). windows-msvc-cpu and windows-msvc-vulkan fail at compile:

D:\a\vllm.cpp\vllm.cpp\src\vllm\model_executor\models\qwen3_5_weights.cpp(955,5):
error C3493: 'kRequired' cannot be implicitly captured because no default
capture mode has been specified [.../vllm.vcxproj]

Observed on the windows-msvc-cpu job of PR #983
(b6f15806b5d001bb8ced0d9f2d19588aca5db8a5, job 95227101818), whose own diff
touches only src/vllm/multimodal/ltx2_video.cpp and cannot reach this TU.

What #1054 changed

-  const auto refuse = [&kRequired](const char* what, MoeProjDtype got,
+  const auto refuse = [](const char* what, MoeProjDtype got,

Why the capture was not redundant

The PR describes this as "the redundant namespace-scope kRequired lambda
capture". That is true of a different variable:

  • kMoeExpertLayoutHelp (qwen3_5_weights.cpp:894) is
    static const std::string at namespace scope. Naming it inside a lambda needs
    no capture.
  • kRequired (:929) is const std::string& kRequired = kMoeExpertLayoutHelp;
    -- a function-local reference, and the lambda body odr-uses it at :959.
    A local reference must be captured.

So MSVC is correct to reject the lambda, and the capture removal is a compile
break rather than a cleanup.

Why no gate caught it

Two reasons, and the second is the reusable one:

  1. fix(qwen3.5): drop redundant AppleClang capture #1054's own verification records "This Linux host has neither CMake nor Clang
    installed, so it cannot reproduce the Apple Clang compilation locally", so the
    change was not compiled by its author on either compiler it concerns.
  2. Its regression gate is a source-text assertion -- it "rejects
    const auto refuse = [&kRequired] and finds const auto refuse = []". That
    assertion passes whether or not the translation unit compiles. It measures the
    diff, not the build, so it cannot fail on the defect it was written to guard.

windows-msvc-* are skipped on main (#503), so main never established green
for them and the break first became visible on the next PR.

Fix

Use the namespace-scope constant inside the lambda instead of the local
reference, which satisfies both compilers and makes #1054's stated intent
actually true:

supported + " there." + kMoeExpertLayoutHelp);

Restoring [&kRequired] would also compile under MSVC but reintroduces the
AppleClang diagnostic #1054 set out to remove.

An instance of #503, not a new report of it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions