[llvm-branch-commits] [clang] [Clang] [C++26] Expansion Statements (Part 10: Expansion Limit) (PR #169689)

Erich Keane via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Tue Mar 31 09:53:38 PDT 2026


erichkeane wrote:

> > How did we derive the 'max' limit default? Experimentally, based on another limit, or in implimits?
> 
> I candidly didn’t derive it at all when I first implemented this. I just picked 256 as a placeholder value and was hoping that we could discuss this and figure out what a reasonable limit should be 👀
> 
> > 1 million instantiations takes about 3 seconds provided the body of the expansion statement is empty
> 
> Apparently, I did run some testing locally though, so maybe 1 million (or the closest power of 2, i.e. `1 << 20`) would be a good value?

Perhaps not that high :)  I could definitely see something like 1024 being reasonable, but I otherwise lack much of a preference. 256 feels a little small, but it isn't clear to me what a reason size will be, particularly with reflection.

Perhaps we should look at some other imp limits that reflection might observe (field limit/arg limit/etc?), and see what number would cover all of those? 

https://github.com/llvm/llvm-project/pull/169689


More information about the llvm-branch-commits mailing list