// RUN: %clang_analyze_cc1 -analyzer-checker=core -verify %s \ // RUN: -analyzer-config unroll-loops=true // expected-no-diagnostics template using conditional_t = T; class basic_format_arg; template struct formatter; template struct value { template value(T) { using value_type = T; (void)format_custom_arg>; } template static void format_custom_arg() { Context ctx; auto f = Formatter(); f.format(0, ctx); } }; struct context { template using formatter_type = formatter; }; enum { max_packed_args }; template using arg_t = conditional_t, basic_format_arg>; template struct format_arg_store { arg_t args; }; template auto make_format_args(T... args) -> format_arg_store { return {args...}; } template void write_padded(F write) { write(0); } template void format(T... args) { make_format_args(args...); } template struct bitset { bitset(long); }; template struct formatter> { struct writer { bitset bs; template void operator()(OutputIt) { for (auto pos = N; pos > 0; --pos) // no-crash ; } }; template void format(bitset bs, FormatContext) { write_padded(writer{bs}); } }; bitset<6> TestBody_bs(2); void TestBody() { format(TestBody_bs); }