[clang] [Clang] Fixed invalid virtual copy constructor assertion (PR #124819)
via cfe-commits
cfe-commits at lists.llvm.org
Sun Feb 9 01:11:37 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()) {
----------------
vortex73 wrote:
I see two potential alternative approaches we could take:
1. Move the validity check to the copy constructor query logic specifically, so we only check the relevant constructor's validity. This would be more targeted than checking all methods.
2. Handle this earlier in the call chain where we first detect an invalid copy constructor, preventing us from reaching canPassInRegisters in the first place.
Which approach do you think would be more appropriate? I can work on a revised patch based on your preferred direction.
For context, I was trying to prevent the assertion failure when dealing with invalid constructors and @shafik mentioned `canPassInRegisters`, but agree we should handle this more gracefully and in a more appropriate location.
https://github.com/llvm/llvm-project/pull/124819
More information about the cfe-commits
mailing list