Skip to content

Commit e5fe6e2

Browse files
Sunrisepeakclaude
andcommitted
fix: avoid std::format width specifiers in print_help()
GCC 15 C++23 modules crash at runtime with std::format_error when using width specifiers like {:20} or {:12}. Replace with manual string padding. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent b8ea117 commit e5fe6e2

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

src/cmdline.cppm

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -146,13 +146,18 @@ public:
146146
if (opt.short_) opt_str += std::format("-{}, ", opt.short_);
147147
if (!opt.long_name.empty()) opt_str += "--" + opt.long_name;
148148
if (!opt.value_name_.empty()) opt_str += " <" + opt.value_name_ + ">";
149-
std::println(" {:20} {}", opt_str, opt.help_);
149+
// Manual padding: GCC 15 C++23 modules crash with {:20} width specifiers
150+
while (opt_str.size() < 20) opt_str += ' ';
151+
std::println(" {} {}", opt_str, opt.help_);
150152
}
151153
}
152154
if (!subcommands_.empty()) {
153155
std::println("\nSUBCOMMANDS:");
154-
for (const auto& sub : subcommands_)
155-
std::println(" {:12} {}", sub.name_, sub.description_.empty() ? "" : sub.description_);
156+
for (const auto& sub : subcommands_) {
157+
std::string padded(sub.name_);
158+
while (padded.size() < 12) padded += ' ';
159+
std::println(" {} {}", padded, sub.description_.empty() ? "" : sub.description_);
160+
}
156161
}
157162
}
158163

0 commit comments

Comments
 (0)