@@ -203,14 +203,10 @@ void stop [[noreturn]] (const std::string& fmt_arg, Args&&... args) {
203203 safe.noreturn (Rf_errorcall)(R_NilValue, " %s" , msg.c_str ());
204204}
205205
206- template <typename ... Args>
207- void warning (const char * fmt_arg, Args&&... args) {
208- std::string msg = fmt::format (fmt_arg, std::forward<Args>(args)...);
209- safe[Rf_warningcall](R_NilValue, " %s" , msg.c_str ());
210- }
206+ // Always making copy of string to avoid weird unwind behavior.
211207
212208template <typename ... Args>
213- void warning (const std::string& fmt_arg, Args&&... args) {
209+ void warning (const std::string fmt_arg, Args&&... args) {
214210 std::string msg = fmt::format (fmt_arg, std::forward<Args>(args)...);
215211 safe[Rf_warningcall](R_NilValue, " %s" , msg.c_str ());
216212}
@@ -225,13 +221,10 @@ void stop [[noreturn]] (const std::string& fmt, Args... args) {
225221 safe.noreturn (Rf_errorcall)(R_NilValue, fmt.c_str (), args...);
226222}
227223
228- template <typename ... Args>
229- void warning (const char * fmt, Args... args) {
230- safe[Rf_warningcall](R_NilValue, fmt, args...);
231- }
224+ // Always making copy of string to avoid weird unwind behavior.
232225
233226template <typename ... Args>
234- void warning (const std::string& fmt, Args... args) {
227+ void warning (const std::string fmt, Args... args) {
235228 safe[Rf_warningcall](R_NilValue, fmt.c_str (), args...);
236229}
237230#endif
0 commit comments