https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113320
Bug ID: 113320
Summary: libstdc++ accepts std::format(std::move(runtime_fmt),
42);
Product: gcc
Version: 14.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: libstdc++
Assignee: unassigned at gcc dot gnu.org
Reporter: hewillk at gmail dot com
Target Milestone: ---
The new constructor of libstdc++'s basic_format_string accepts an rvalue
reference to a runtime-format-string instead of a value, which makes the
following incorrectly accepted:
#include <format>
int main() {
auto runtime_fmt = std::runtime_format("{}");
auto str = std::format(std::move(runtime_fmt), 42); // should error
}
https://godbolt.org/z/zjW7shba1