mirror of
https://github.com/fmtlib/fmt.git
synced 2025-07-30 02:37:36 +02:00
Test nondeterministic conversion to format string
This commit is contained in:
@ -868,3 +868,17 @@ TEST(base_test, format_to_custom_container) {
|
|||||||
auto c = custom_container();
|
auto c = custom_container();
|
||||||
fmt::format_to(std::back_inserter(c), "");
|
fmt::format_to(std::back_inserter(c), "");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct nondeterministic_format_string {
|
||||||
|
mutable int i = 0;
|
||||||
|
FMT_CONSTEXPR operator string_view() const {
|
||||||
|
return string_view("{}", i++ != 0 ? 2 : 0);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
TEST(base_test, no_repeated_format_string_conversions) {
|
||||||
|
#if !FMT_GCC_VERSION
|
||||||
|
char buf[10];
|
||||||
|
fmt::format_to(buf, nondeterministic_format_string());
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
Reference in New Issue
Block a user