[clang] [clang-tools-extra] [clang][NFC] Un-constify `MultiLevelTemplateArgumentList` (PR #104687)

via cfe-commits cfe-commits at lists.llvm.org
Sun Aug 18 09:02:51 PDT 2024


cor3ntin wrote:

> I'm not sure I understand, because MLTAL doesn't seem to own the arguments in the first place, so copying it doesn't seem of any help.

Well, yes, we would have to create a copy of the argument list corresponding to the depth of the pack we are trying to deduce.
There may be a better solution to implement https://eel.is/c++draft/temp.arg.explicit#9.
Maybe @mizvekov would have an idea. But I suspect any such solution would be an even bigger refactor.

So, unless we have a clever idea, I would like to see explored a solution that clones `MultiLevelTemplateArgumentList` instead of mutating it in place. (`TemplateInstantiator` would own a stack of `SmallVector<TemplateArgument>`) We could also add in `MultiLevelTemplateArgumentList::ArgList` an `optional<unsigned>` that tracks if a given template argument should be treated to be null, such that cloning a `MultiLevelTemplateArgumentList` just sets that optional.

This would limit the changes to `TemplateInstantiator`



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


More information about the cfe-commits mailing list