[#absl-Status-WithSourceLocation-0f]
= xref:absl.adoc[absl]::xref:absl/Status.adoc[Status]::WithSourceLocation
:relfileprefix: ../../
:mrdocs:

Appends the `loc` to the current location chain inside the status iff the status is non&hyphen;ok and contains a non&hyphen;empty message, and returns an rvalue reference to `&ast;this`&period;

== Synopsis

Declared in `&lt;absl&sol;status&sol;status&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
&lsqb;&lsqb;nodiscard&rsqb;&rsqb;
xref:absl/Status.adoc[Status]&&
WithSourceLocation(xref:absl/SourceLocation.adoc[absl::SourceLocation] loc = absl&colon;&colon;SourceLocation&colon;&colon;current()) &amp;&amp;;
----

== Description

Example&colon;

Status Finalize(&period;&period;&period;)&semi;

Status DoSomething(&period;&period;&period;) &lcub; &period;&period;&period; return Finalize()&period;WithSourceLocation()&semi; &rcub;

== Return Value

An rvalue reference to `&ast;this`&period;

[NOTE]
====
The return value https://en.cppreference.com/cpp/language/attributes/nodiscard[should not be discarded^].
====
== Parameters

[cols="1,4"]
|===
| Name| Description
| *loc*
| The source location to append&period;
|===


[.small]#Created with https://www.mrdocs.com[MrDocs]#
