================
@@ -83,7 +83,14 @@ ComparisonCategoryInfo::ValueInfo 
*ComparisonCategoryInfo::lookupValueInfo(
       &Ctx.Idents.get(ComparisonCategories::getResultString(ValueKind)));
   if (Lookup.empty() || !isa<VarDecl>(Lookup.front()))
     return nullptr;
-  Objects.emplace_back(ValueKind, cast<VarDecl>(Lookup.front()));
+  // The static member must have the same type as the comparison category class
+  // itself (e.g., std::partial_ordering::less must be of type 
partial_ordering).
+  VarDecl *ValueDecl = cast<VarDecl>(Lookup.front());
+  const CXXRecordDecl *ValueDeclRecord = 
ValueDecl->getType()->getAsCXXRecordDecl();
+  if (!ValueDeclRecord || ValueDeclRecord->getCanonicalDecl() != 
Record->getCanonicalDecl())
----------------
ojhunt wrote:

Nit: this line is too long, it's weird the style bot didn't complain - running 
clang-format over this should fix that.

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

Reply via email to