[clang] [clang] Exclude non-template classes when checking if constraint refers to containing template arguments (PR #74265)

Erich Keane via cfe-commits cfe-commits at lists.llvm.org
Tue Dec 5 08:20:24 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())
----------------
erichkeane wrote:

Hmm... I THINK that should be rejected, since you can't name `Child` without naming `Parent`?  But I don't think the standard is explicit about that.

So perhaps `isTemplated` is what we want here.

I didn't think it too far through when making the comment, but I'm glad you put together a good example.



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


More information about the cfe-commits mailing list