[PATCH] D86936: [clang] Limit the maximum level of fold-expr expansion.

Haojian Wu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Sep 2 02:12:12 PDT 2020


hokein added inline comments.


================
Comment at: clang/lib/Sema/TreeTransform.h:13196
+  if (NumExpansions && SemaRef.getLangOpts().BracketDepth < NumExpansions) {
+    SemaRef.Diag(E->getEllipsisLoc(),
+                 clang::diag::err_fold_expression_expansion_exceeded)
----------------
sammccall wrote:
> you might also want to emit note_bracket_depth (I don't think you need to clone it if we get the wording right)
note_bracket_depth is from parse diagnostic, introducing it in Sema feels like a slight layer violation, but the compile should be fine, because all diagnostic headers in the support library.


================
Comment at: clang/test/SemaCXX/fold_expr_expansion_limit.cpp:8
+auto x = __make_integer_seq<seq, int, N>{};
+static_assert(!x.zero(), ""); // expected-error {{static_assert expression is not an integral constant expression}} \
+                                 expected-note {{in instantiation of member function}}
----------------
sammccall wrote:
> this diagnostic is bogus :-(
> default-fatal would fix this, I guess.
oh, yeah, if a fatal error is emitted, all subsequent diagnostics will be silenced.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D86936



More information about the cfe-commits mailing list