[all-commits] [llvm/llvm-project] 5665e7: [Clang] [C++26] Expansion Statements (Part 10: Exp...

Sirraide via All-commits all-commits at lists.llvm.org
Fri Jul 10 13:01:00 PDT 2026


  Branch: refs/heads/users/Sirraide/expansion-stmts-9-control-flow
  Home:   https://github.com/llvm/llvm-project
  Commit: 5665e7bc511d0fb16b15bf45dbde028a4f4d0575
      https://github.com/llvm/llvm-project/commit/5665e7bc511d0fb16b15bf45dbde028a4f4d0575
  Author: Sirraide <aeternalmail at gmail.com>
  Date:   2026-07-10 (Fri, 10 Jul 2026)

  Changed paths:
    M clang/docs/ReleaseNotes.rst
    M clang/include/clang/Basic/DiagnosticCommonKinds.td
    A clang/test/AST/ast-dump-expansion-stmt.cpp
    A clang/test/AST/ast-print-expansion-stmts.cpp
    M clang/www/cxx_status.html

  Log Message:
  -----------
  [Clang] [C++26] Expansion Statements (Part 10: Expansion Limit) (#169689)

This implements a limit on the maximum number of expansions; this isn’t
in the standard (there is nothing on this in [implimits]), but my
reasoning is that if someone makes a mistake and inadvertently causes
e.g. 1 000 000 000 instantiations, Clang is going to hang... basically
for ever (for comparison, 1 million instantiations takes about 3 seconds
provided the body of the expansion statement is empty).

For now, I’ve set the limit to `256`, but that’s probably too low. I
don’t have strong opinions on the exact value; I definitely *do* think
that there should be *a* limit though. We *could* in theory reuse the
constexpr-steps value, but it feels a bit weird because this isn’t
really doing constant evaluation so much as just template instantiation.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list