Z3rox-dev wrote:

@zwuis thanks for the follow-up, and good catch on the `stdget` making the 
whole program invalid regardless.

To clarify — the current revision of this PR is a Sema-only fix (no CodeGen 
changes). The diff is just two changes in `SemaTemplate.cpp`:

1. `checkMoreSpecializedThanPrimary()` emits the diagnostic but didn't call 
`setInvalidDecl()` — this adds it.
2. `ActOnClassTemplateSpecialization()` called `setInvalidDecl(Invalid)` where 
`Invalid` is `false` for partial specializations, clearing flags set by earlier 
checks — this changes it to only set the flag, never clear it.

This isn't hiding the problem — it's fixing a missing `setInvalidDecl()` call. 
The partial specialization *is* invalid (not more specialized than the 
primary), so marking it as such is the correct behavior and consistent with how 
other diagnostics in Sema work. The downstream deduction/instantiation 
infrastructure already skips invalid decls.

Your `template <auto>` variant is a different bug: the partial specialization 
there is valid, but `CXXUnresolvedConstructExpr` still survives instantiation. 
That's a deeper issue in template instantiation itself, tracked in #181062 and 
assigned to @mizvekov. This PR doesn't attempt to address it — only the crash 
path through invalid partial specializations (#181410).


https://github.com/llvm/llvm-project/pull/181561
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to