================
@@ -2738,6 +2738,13 @@ bool Sema::DiagnoseEmptyLookup(Scope *S, CXXScopeSpec
&SS, LookupResult &R,
<< DroppedSpecifier << NameRange,
PDiag(NoteID), AcceptableWithRecovery);
+ if (Corrected.WillReplaceSpecifier()) {
+ NestedNameSpecifier NNS = Corrected.getCorrectionSpecifier();
+ // In order to be valid, a non-empty CXXScopeSpec needs a source range.
+ SS.MakeTrivial(Context, NNS,
+ NNS ? NameRange.getBegin() : SourceRange());
+ }
----------------
ojhunt wrote:
This kind of pattern seems to happen a lot - I looked at the original report
stack trace and I think it would be a good idea to add an assertion to
`NestedNameSpecifierLocBuilder::MakeTrivial`, e.g.
```cpp
void MakeTrivial(ASTContext &Context, NestedNameSpecifier Qualifier,
SourceRange R) {
assert(!NNS || R.isValid());
Representation = Qualifier;
BufferSize = 0;
PushTrivial(Context, Qualifier, R);
}
```
Just so it gets caught earlier in the "things are going wrong" pipeline.
Also: another case where the default nullability of all these types makes me
sad :-/
https://github.com/llvm/llvm-project/pull/183937
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits