@@ -201,14 +201,10 @@ void stop [[noreturn]] (const std::string& fmt_arg, Args&&... args) {
201201 safe.noreturn (Rf_errorcall)(R_NilValue, " %s" , msg.c_str ());
202202}
203203
204- template <typename ... Args>
205- void warning (const char * fmt_arg, Args&&... args) {
206- std::string msg = fmt::format (fmt_arg, std::forward<Args>(args)...);
207- safe[Rf_warningcall](R_NilValue, " %s" , msg.c_str ());
208- }
204+ // Always making copy of string to avoid weird unwind behavior.
209205
210206template <typename ... Args>
211- void warning (const std::string& fmt_arg, Args&&... args) {
207+ void warning (const std::string fmt_arg, Args&&... args) {
212208 std::string msg = fmt::format (fmt_arg, std::forward<Args>(args)...);
213209 safe[Rf_warningcall](R_NilValue, " %s" , msg.c_str ());
214210}
@@ -223,13 +219,10 @@ void stop [[noreturn]] (const std::string& fmt, Args... args) {
223219 safe.noreturn (Rf_errorcall)(R_NilValue, fmt.c_str (), args...);
224220}
225221
226- template <typename ... Args>
227- void warning (const char * fmt, Args... args) {
228- safe[Rf_warningcall](R_NilValue, fmt, args...);
229- }
222+ // Always making copy of string to avoid weird unwind behavior.
230223
231224template <typename ... Args>
232- void warning (const std::string& fmt, Args... args) {
225+ void warning (const std::string fmt, Args... args) {
233226 safe[Rf_warningcall](R_NilValue, fmt.c_str (), args...);
234227}
235228#endif
0 commit comments