[clang] [Clang][Sema] Mark partial specializations invalid when not more specialized than primary (PR #181561)

Yanzuo Liu via cfe-commits cfe-commits at lists.llvm.org
Mon Feb 16 08:13:31 PST 2026


zwuis wrote:

> This is not the right fix. ~~This initializer should not be value-dependent.~~ If you change a part of reproducer to
> 
> ```cpp
> template <auto>
> struct MetaValuesHelper;
> 
> template <typename TupleName, TupleName* kValues>
> struct MetaValuesHelper<kValues> {
> ```
> 
> , the code becomes valid but Clang still crashes.
> 
> Update: Not sure if `assert(!Init->isValueDependent());` is correct. But if you see the AST via `-Xclang -ast-dump`, the initializer is `CXXUnresolvedConstructExpr`, which seemed incorrect.

I just find that I missed something. This changes only makes partial specialization part valid. The whole program is still invalid  because we use an unknown `stdget`. And there is still a `CXXUnresolvedConstructExpr`.

It would be better to resolve this case, so the original issue will be fixed simultaneously. Marking the declaration invalid hides the underlying issue, and worsen error recovery.

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


More information about the cfe-commits mailing list