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

Nikolas Klauser via cfe-commits cfe-commits at lists.llvm.org
Mon Jun 15 00:07:11 PDT 2026


================
@@ -1560,6 +1560,9 @@ Sema::BuildCXXTypeConstructExpr(TypeSourceInfo *TInfo,
       Inits = MultiExprArg(ILE->getInits(), ILE->getNumInits());
     }
 
+    if (Ty->getAs<AutoType>())
----------------
philnik777 wrote:

Are you asking me to move it further up? The function you pointed out lives in a separate branch, so we don't diagnose anything there whether it's successful or not. I don't think you can ever get there with an auto cast.

> Drive-by question that's an existing issue if it's an issue at all: should we be looking at the spelling here so we don't diagnose `__auto_type` as a C++23 extension?

Doesn't seem to be an issue: https://godbolt.org/z/YeTPnEenc



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


More information about the cfe-commits mailing list