pitrou commented on code in PR #44493:
URL: https://github.com/apache/arrow/pull/44493#discussion_r1828133073


##########
cpp/src/arrow/status.cc:
##########
@@ -160,7 +163,11 @@ void Status::AddContextLine(const char* filename, int 
line, const char* expr) {
   ARROW_CHECK(!ok()) << "Cannot add context line to ok status";
   std::stringstream ss;
   ss << "\n" << filename << ":" << line << "  " << expr;
-  state_->msg += ss.str();
+  if (state_->is_constant) {
+    // We can't add context lines to a StatusConstant's state, so copy it now
+    state_ = new State{code(), message(), detail()};
+  }
+  const_cast<State*>(state_)->msg += ss.str();

Review Comment:
   Why did we make the state `const` if we need the `const_cast` here?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to