Saner test exception in ExceptionWrapperTest.cpp
[folly.git] / folly / test / ExceptionWrapperTest.cpp
index 07930ee0c2f098d28d6fd3edbfb7a09fec9dbedf..58a32a17b6d39b149b5518222a5aa4f0f17ce2c9 100644 (file)
@@ -29,17 +29,16 @@ class AbstractIntException : public std::exception {
 
 class IntException : public AbstractIntException {
  public:
-  explicit IntException(int i) : i_(i) {}
+  explicit IntException(int i) : i_(i), what_(to<std::string>("int == ", i_)) {}
 
   int getInt() const override { return i_; }
   const char* what() const noexcept override {
-    what_ = folly::to<std::string>("int == ", i_);
     return what_.c_str();
   }
 
  private:
   int i_;
-  mutable std::string what_;
+  std::string what_;
 };
 
 const static std::string kExceptionClassName =