[clang] [clang] Add support for consteval null terminated strings (PR #173140)
Oliver Hunt via cfe-commits
cfe-commits at lists.llvm.org
Sat Dec 20 01:12:24 PST 2025
================
@@ -17726,6 +17764,10 @@ static bool EvaluateAsStringImpl(Sema &SemaRef, Expr *Message,
SourceLocation Loc = Message->getBeginLoc();
QualType T = Message->getType().getNonReferenceType();
+ if (T->isPointerType() && T->getPointeeType()->isCharType())
+ return EvaluateAsNullTerminatedCharBuffer(
+ SemaRef, Message, Result, Ctx, EvalContext, ErrorOnInvalidMessage);
+
----------------
ojhunt wrote:
A _gross_ option would be to have a langopt + "enable this" cli flag, but that would imply people be able to rely on being able to do this.
https://github.com/llvm/llvm-project/pull/173140
More information about the cfe-commits
mailing list