[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
Mon Dec 4 07:42:25 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:

So this might not be the 'right' thing here.  "isTemplated" doesn't mean "this is a template", it means "this, or something that contains it is a template".

So:

```
template <typename T>
struct Parent {
   struct Child {
    };
};
```

In this case, `Parent` is a class template, but `Child` is still `isTemplated`.  

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


More information about the cfe-commits mailing list