https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110845
Bug ID: 110845 Summary: Function call when it should inline? Product: gcc Version: 13.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: deco33000 at yandex dot com Target Milestone: --- Hi, The below code is inlined in clang (trunk) but not in gcc (13.2). The code: #include <format> #include <iostream> using namespace std; constexpr auto f(bool a) -> void { if (a) { cout << format("hello 1\n"); } else { cout << format("hello 2\n"); } } template <bool T> constexpr auto g() -> void { if constexpr (T) { cout << format("hello 3\n"); } else { cout << format("hello 4\n"); } } int main() { f(true); f(false); g<true>(); g<false>(); } flags = -std=c++23 -O3 You can see/test the Godbolt here: https://godbolt.org/z/aK86nKzYs Maybe it is related to "format" because without it, it inlines properly.