Skip to content

Commit b748920

Browse files
committed
[Diagnostic] Non-ephemeral pointer init diagnostic should point to .init if present
1 parent 1dc6a0a commit b748920

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

lib/Sema/CSDiagnostics.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5936,8 +5936,9 @@ bool NonEphemeralConversionFailure::diagnosePointerInit() const {
59365936
? diag::cannot_construct_dangling_pointer_warning
59375937
: diag::cannot_construct_dangling_pointer;
59385938

5939-
emitDiagnostic(diagID, constructedTy, constructorKind)
5940-
.highlight(getSourceRange());
5939+
auto *anchor = getRawAnchor();
5940+
emitDiagnosticAt(anchor->getLoc(), diagID, constructedTy, constructorKind)
5941+
.highlight(anchor->getSourceRange());
59415942

59425943
emitSuggestionNotes();
59435944
return true;

0 commit comments

Comments
 (0)