[PATCH] D131423: [clang] fix frontend crash when evaluating type trait

YingChi Long via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Aug 11 11:39:03 PDT 2022


inclyc added inline comments.


================
Comment at: clang/lib/Parse/ParseExprCXX.cpp:3783
 
-  if (Arity && Args.size() != Arity) {
-    Diag(EndLoc, diag::err_type_trait_arity)
----------------
Before this patch, we check the `Arity` here, so using type traits with unexpected number of arguments does not crash clang

See https://godbolt.org/z/afGxvqdEh


================
Comment at: clang/lib/Sema/SemaExprCXX.cpp:5433
                                 SourceLocation RParenLoc) {
+  if (!CheckTypeTraitArity(getTypeTraitArity(Kind), KWLoc, Args.size()))
+    return ExprError();
----------------
Moves to here.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D131423/new/

https://reviews.llvm.org/D131423



More information about the cfe-commits mailing list