[clang] [clang][Sema] Fix rejection of non-dependent void{} during template instantiation (PR #228340)
Oliver Hunt via cfe-commits
cfe-commits at lists.llvm.org
Thu Nov 12 23:15:37 PST 2026
================
@@ -1692,13 +1687,12 @@ Sema::BuildCXXTypeConstructExpr(TypeSourceInfo *TInfo,
// to false.
bool IsListInit = ListInitialization ||
(getLangOpts().HLSL && isa<InitListExpr>(Result.get()));
- SourceRange Locs = IsListInit
- ? SourceRange()
- : SourceRange(LParenOrBraceLoc, RParenOrBraceLoc);
+ auto LParenOrBraceOrNullLoc =
+ IsListInit ? SourceLocation() : LParenOrBraceLoc;
Result = CXXFunctionalCastExpr::Create(
Context, ResultType, Expr::getValueKindForType(Ty), TInfo, CK_NoOp,
Result.get(), /*Path=*/nullptr, CurFPFeatureOverrides(),
- Locs.getBegin(), Locs.getEnd());
+ LParenOrBraceOrNullLoc, RParenOrBraceLoc);
}
----------------
ojhunt wrote:
I would rather make this explicit rather than saving a couple of lines of code - e.g `if (IsListInit) ...CreateListInitializer(...) else ...`
https://github.com/llvm/llvm-project/pull/228340
More information about the cfe-commits
mailing list