[clang] [clang][Sema] Fix rejection of non-dependent void{} during template instantiation (PR #228340)

Ivy Xu via cfe-commits cfe-commits at lists.llvm.org
Sun Oct 4 00:19:52 PDT 2026


================
@@ -1646,8 +1646,8 @@ Sema::BuildCXXTypeConstructExpr(TypeSourceInfo *TInfo,
         cast<InitListExpr>(Exprs[0])->getNumInits() == 0) {
       return CXXFunctionalCastExpr::Create(
           Context, Ty.getUnqualifiedType(), VK_PRValue, TInfo, CK_ToVoid,
-          Exprs[0], /*Path=*/nullptr, CurFPFeatureOverrides(),
-          Exprs[0]->getBeginLoc(), Exprs[0]->getEndLoc());
+          Exprs[0], /*Path=*/nullptr, CurFPFeatureOverrides(), SourceLocation(),
+          Exprs[0]->getEndLoc());
     }
----------------
IvyXu420 wrote:

For now, `int{}` is represented by CXXFunctionalCastExpr, while `int()` is represented by CXXScalarValueInitExpr.

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


More information about the cfe-commits mailing list