[clang] [clang][Sema] Diagnose unsatisfied constraints on rejected partial specializations (PR #239106)

via cfe-commits cfe-commits at lists.llvm.org
Fri Nov 6 01:40:38 PST 2026


tribhu05 wrote:

Thank you for the detailed review and guidance, @ojhunt!

I have addressed all the feedback in the latest commit:
- **Doxygen comments:** Replaced the comments in `clang/include/clang/Sema/Sema.h` with concise, standard Clang documentation.
- **Code deduplication:** Unified the class template and variable template partial specialization diagnostic logic into a single `NoteUnsatisfiedPartialSpecializationsImpl` template helper, removing the duplicated traversal, argument deduction, and binding formatting logic.
- **`dyn_cast_or_null`:** Replaced all redundant `dyn_cast_or_null` calls with `dyn_cast` across `SemaDeclCXX.cpp`, `SemaExpr.cpp`, `SemaExprMember.cpp`, and `SemaTemplate.cpp` where the context pointer is already verified non-null.
- **Assertion:** Added `assert(Templated && "Expected non-null templated declaration");` in `getTemplateParameters` in `SemaOverload.cpp`.
- **Null check on `Selected`:** Clarified with comments that `Selected` is intentionally null when the primary template was instantiated (as opposed to a partial specialization).
- **Test formatting:** Updated `concepts-class-template-partial-spec-notes.cpp` to use `#label` line tags (e.g., `// #case1_spec`) and placed the corresponding `// expected-note@#case1_spec` directives at the instantiation sites.

All tests have been verified with `lit` and pass cleanly.


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


More information about the cfe-commits mailing list