[clang] [clang] Disambiguate lambdas from Microsoft attributes (PR #214247)

via cfe-commits cfe-commits at lists.llvm.org
Wed Sep 16 11:48:00 PDT 2026


vangthao95 wrote:

The relevant cases are lambdas in parenthesized direct initializers, where Clang must distinguish `Type foo([x] mutable {});` from an MSVC-attributed function declaration such as `Type foo([helpstring("h")] int);`.

I confirmed that MSVC accepts both forms, while Clang rejects the lambda with `invalid storage class specifier in function declarator` because it treats [x] as a Microsoft attribute and parses the initializer as a function declaration.

Removed some irrelevant tests that were not in the right form.

https://github.com/llvm/llvm-project/pull/214247


More information about the cfe-commits mailing list