sql: Work around Clang 17/18 run-time call to consteval function

There was an issue with Clang that causes `consteval` function calls
from default initializers of fields to be made at run-time. This
manifested itself in the case of `ByteString::formatted` as an undefined
reference to `check_format_parameter_consistency` once format string
checking was enabled for Clang builds. The workaround is simple (just
move it to the member initializer list), and unblocks a useful change.
This commit is contained in:
Daniel Bertalan 2024-05-21 12:49:35 +02:00 committed by Andrew Kaster
parent ca806a3e18
commit 9d3b73743e
Notes: sideshowbarker 2024-07-17 03:00:02 +09:00

View file

@ -26,7 +26,8 @@
class SQLRepl {
public:
explicit SQLRepl(Core::EventLoop& loop, ByteString const& database_name, NonnullRefPtr<SQL::SQLClient> sql_client)
: m_sql_client(move(sql_client))
: m_history_path(ByteString::formatted("{}/.sql-history", Core::StandardPaths::home_directory()))
, m_sql_client(move(sql_client))
, m_loop(loop)
{
m_editor = Line::Editor::construct();
@ -147,7 +148,7 @@ public:
}
private:
ByteString m_history_path { ByteString::formatted("{}/.sql-history", Core::StandardPaths::home_directory()) };
ByteString m_history_path;
RefPtr<Line::Editor> m_editor { nullptr };
int m_repl_line_level { 0 };
bool m_keep_running { true };