-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[Clang][Sema] Fix crash when diagnosing near-match for 'constexpr' redeclaration in C++11 #92452
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -9217,19 +9217,20 @@ static NamedDecl *DiagnoseInvalidRedeclaration( | |||||
<< Idx << FDParam->getType() | ||||||
<< NewFD->getParamDecl(Idx - 1)->getType(); | ||||||
} else if (FDisConst != NewFDisConst) { | ||||||
SemaRef.Diag(FD->getLocation(), diag::note_member_def_close_const_match) | ||||||
<< NewFDisConst << FD->getSourceRange().getEnd() | ||||||
<< (NewFDisConst | ||||||
? FixItHint::CreateRemoval(ExtraArgs.D.getFunctionTypeInfo() | ||||||
.getConstQualifierLoc()) | ||||||
: FixItHint::CreateInsertion(ExtraArgs.D.getFunctionTypeInfo() | ||||||
.getRParenLoc() | ||||||
.getLocWithOffset(1), | ||||||
" const")); | ||||||
} else | ||||||
auto DB = SemaRef.Diag(FD->getLocation(), | ||||||
diag::note_member_def_close_const_match) | ||||||
<< NewFDisConst << FD->getSourceRange().getEnd(); | ||||||
if (const auto &FTI = ExtraArgs.D.getFunctionTypeInfo(); !NewFDisConst) | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
This is closer to what we mean, right? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Er, no. We want to suggest removing There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Woops, I forgot my other change :D I meant There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think it would work either way... since this is guarded by There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, I agree it is not really a meaningful change, besides being a bit of a 'say what you mean'. That is, use the variable that is more closely related to what we MEAN. I haven't reviewed this in long enough to know if I was correct here, so if you're sure that the variable you're using is the one that properly states the intent, feel free to ignore hte comment. |
||||||
DB << FixItHint::CreateInsertion(FTI.getRParenLoc().getLocWithOffset(1), | ||||||
" const"); | ||||||
else if (FTI.hasMethodTypeQualifiers() && | ||||||
FTI.getConstQualifierLoc().isValid()) | ||||||
DB << FixItHint::CreateRemoval(FTI.getConstQualifierLoc()); | ||||||
} else { | ||||||
SemaRef.Diag(FD->getLocation(), | ||||||
IsMember ? diag::note_member_def_close_match | ||||||
: diag::note_local_decl_close_match); | ||||||
} | ||||||
} | ||||||
return nullptr; | ||||||
} | ||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a bug # for this one?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't know, I just happened upon it when working on #92449... I'll check
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I looked, but couldn't find any
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nevermind, I did :) #61004