[clang] [Clang] Fixed invalid virtual copy constructor assertion (PR #124819)

Erich Keane via cfe-commits cfe-commits at lists.llvm.org
Tue Feb 4 08:20:12 PST 2025


================
@@ -6697,6 +6697,10 @@ static bool canPassInRegisters(Sema &S, CXXRecordDecl *D,
   if (D->isDependentType() || D->isInvalidDecl())
     return false;
 
+  for (const CXXMethodDecl *MD : D->methods()) {
----------------
erichkeane wrote:

I'm not sure where the RIGHT place for this to happen is, but this function very much does not seem like the right one.  I would expect that the caller to this should 'give up' if there isn't value to calling this.

Alternatively, the copy-constructor querying could possibly look into this instead when it is inspecting for the actual method it cares about.

This patch also is checking ALL methods, which seems wrong.  An arbitrary invalid method in the type shouldn't change the answer to this.

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


More information about the cfe-commits mailing list