[clang] [clang] Exclude non-template classes when checking if constraint refers to containing template arguments (PR #74265)
via cfe-commits
cfe-commits at lists.llvm.org
Tue Dec 5 00:27:19 PST 2023
================
@@ -1714,6 +1714,8 @@ class ConstraintRefersToContainingTemplateChecker
// Friend, likely because it was referred to without its template arguments.
void CheckIfContainingRecord(const CXXRecordDecl *CheckingRD) {
CheckingRD = CheckingRD->getMostRecentDecl();
+ if (!CheckingRD->isTemplated())
----------------
antangelo wrote:
What do you think about this example, which exercises this issue in the above case? https://godbolt.org/z/Yz1WEqM7M
If I switch from `isTemplated()` to `getDescribedTemplate()` to only check `CheckingRD` itself, then clang will accept that code. Otherwise, as the patch is now, the example is rejected. What should be the correct behavior?
https://github.com/llvm/llvm-project/pull/74265
More information about the cfe-commits
mailing list