[clang] [Clang] Accept auto casts pre-C++23 as an extension (PR #200675)

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Tue Jun 2 05:17:52 PDT 2026


================
@@ -105,9 +105,8 @@ namespace BadSpecifiers {
     // defining-type-specifiers other than cv-qualifiers and 'auto'
     S [a] = s; // expected-error {{cannot be declared with type 'S'}}
     decltype(auto) [b] = s; // expected-error {{cannot be declared with type 'decltype(auto)'}}
-    auto ([c2]) = s; // cxx17-error {{structured binding declaration cannot be declared with parenthese}} \
-                     // post2b-error {{use of undeclared identifier 'c2'}} \
-                     // post2b-error {{expected body of lambda expression}} \
+    auto ([c2]) = s; // expected-error {{use of undeclared identifier 'c2'}} \
----------------
AaronBallman wrote:

This matches GCC but the diagnostic behavior is worse IMO because this is still a gramatically invalid declaration for a structured binding, so the lookup error isn't helpful. I think we should add a FIXME comment.

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


More information about the cfe-commits mailing list