3.8 indentation with -fdiagnostics-show-template-tree doesn't show tree

I've downloaded:

~/dwnlds/llvm/3.8/prebuilt $ wget http://www.llvm.org/releases/3.8.0/clang+llvm-3.8.0-x86_64-linux-gnu-ubuntu-14.04.tar.xz.sig

untarred it, and compiled a simple program:

#include <vector>

int main()
{
   std::vector<float > vecf(2);
   std::vector<double> vecd(2);
   vecf = vecd;
   return 0;
}

resulting in, as expected, an indented error message showing the tree:

       candidate function not viable: no known conversion from argument type to parameter type for 1st argument
   vector<
     [double != float],
     allocator<
       [double != float]>>
     vector& operator=(vector&& __x)
             ^

However, when compiling a much more complex template program, there's no tree evident by the indentation:

/home/evansl/dwnlds/llvm/3.8/prebuilt/clang+llvm-3.8.0-x86_64-linux-gnu-ubuntu-14.04/bin/clang++ -c -O0 -stdlib=libc++ -std=c++14 -ftemplate-backtrace-limit=0 -fdiagnostics-show-template-tree -fno-elide-type -fmacro-backtrace-limit=0 -I/home/evansl/prog_dev/boost/github/TBoost.Conversion -I/home/evansl/prog_dev/boost/sandbox/lje/non_variadic_templates -I/home/evansl/prog_dev/clang/libcxx/sandbox/libs/composite_storage/include -I../../../../../../boost/sandbox/lje/sandbox/lje -I/home/evansl/prog_dev/boost/releases/ro/boost_1_59_0 -DTYPE_AT_IMPL=0 -ftemplate-depth=100 texpressions.cpp -MMD -o /tmp/build/clangxx3_8_pkg/clang/libcxx/sandbox/libs/gram_stk/sandbox/texpressions.o

In file included from texpressions.cpp:1:
./texpressions.hpp:1264:46: error: no member named 'size' in 'texpressions<my_symbols>::gram_defs<my_attrs,
composite_storage::type_sequence<texpressions<my_symbols>::gram_def1<my_symbols<symb_kinds::varble_kind>::syms::varble0,
       def_ops::def_act, composite_storage::top (), var_ptr_bool::var_ptr_yes,
texpressions<my_symbols>::gram_expr<op_assoc<ops_non_nullary::op_bitor, associativity::assoc_left>,
texpressions<my_symbols>::gram_expr<texpressions<my_symbols>::op_symb<symb_kinds::literl_kind,
       my_symbols<symb_kinds::literl_kind>::syms::literl0>>,
texpressions<my_symbols>::gram_expr<op_assoc<ops_non_nullary::op_bitand, associativity::assoc_left>,
texpressions<my_symbols>::gram_expr<texpressions<my_symbols>::op_symb<symb_kinds::literl_kind,
       my_symbols<symb_kinds::literl_kind>::syms::literl1>>,
texpressions<my_symbols>::gram_expr<texpressions<my_symbols>::op_symb<symb_kinds::literl_kind,
       my_symbols<symb_kinds::literl_kind>::syms::literl0>> > > > > >::attr_expr<op_assoc<ops_non_nullary::op_bitor,
       associativity::assoc_left>, texpressions<my_symbols>::gram_defs<my_attrs,
composite_storage::type_sequence<texpressions<my_symbols>::gram_def1<my_symbols<symb_kinds::varble_kind>::syms::varble0,
       def_ops::def_act, composite_storage::top (), var_ptr_bool::var_ptr_yes,
texpressions<my_symbols>::gram_expr<op_assoc<ops_non_nullary::op_bitor, associativity::assoc_left>,
texpressions<my_symbols>::gram_expr<texpressions<my_symbols>::op_symb<symb_kinds::literl_kind,
       my_symbols<symb_kinds::literl_kind>::syms::literl0>>,
texpressions<my_symbols>::gram_expr<op_assoc<ops_non_nullary::op_bitand, associativity::assoc_left>,
texpressions<my_symbols>::gram_expr<texpressions<my_symbols>::op_symb<symb_kinds::literl_kind,
       my_symbols<symb_kinds::literl_kind>::syms::literl1>>,
texpressions<my_symbols>::gram_expr<texpressions<my_symbols>::op_symb<symb_kinds::literl_kind,
       my_symbols<symb_kinds::literl_kind>::syms::literl0>> > > > >
  >::attr_expr<texpressions<my_symbols>::op_symb<symb_kinds::literl_kind,
       my_symbols<symb_kinds::literl_kind>::syms::literl0>>, texpressions<my_symbols>::gram_defs<my_attrs,
composite_storage::type_sequence<texpressions<my_symbols>::gram_def1<my_symbols<symb_kinds::varble_kind>::syms::varble0,
       def_ops::def_act, composite_storage::top (), var_ptr_bool::var_ptr_yes,
texpressions<my_symbols>::gram_expr<op_assoc<ops_non_nullary::op_bitor, associativity::assoc_left>,
texpressions<my_symbols>::gram_expr<texpressions<my_symbols>::op_symb<symb_kinds::literl_kind,
       my_symbols<symb_kinds::literl_kind>::syms::literl0>>,
texpressions<my_symbols>::gram_expr<op_assoc<ops_non_nullary::op_bitand, associativity::assoc_left>,
texpressions<my_symbols>::gram_expr<texpressions<my_symbols>::op_symb<symb_kinds::literl_kind,
       my_symbols<symb_kinds::literl_kind>::syms::literl1>>,
texpressions<my_symbols>::gram_expr<texpressions<my_symbols>::op_symb<symb_kinds::literl_kind,
       my_symbols<symb_kinds::literl_kind>::syms::literl0>> > > > > >::attr_expr<op_assoc<ops_non_nullary::op_bitand,
       associativity::assoc_left>, texpressions<my_symbols>::gram_defs<my_attrs,
composite_storage::type_sequence<texpressions<my_symbols>::gram_def1<my_symbols<symb_kinds::varble_kind>::syms::varble0,
       def_ops::def_act, composite_storage::top (), var_ptr_bool::var_ptr_yes,
texpressions<my_symbols>::gram_expr<op_assoc<ops_non_nullary::op_bitor, associativity::assoc_left>,
texpressions<my_symbols>::gram_expr<texpressions<my_symbols>::op_symb<symb_kinds::literl_kind,
       my_symbols<symb_kinds::literl_kind>::syms::literl0>>,
texpressions<my_symbols>::gram_expr<op_assoc<ops_non_nullary::op_bitand, associativity::assoc_left>,
texpressions<my_symbols>::gram_expr<texpressions<my_symbols>::op_symb<symb_kinds::literl_kind,
       my_symbols<symb_kinds::literl_kind>::syms::literl1>>,
texpressions<my_symbols>::gram_expr<texpressions<my_symbols>::op_symb<symb_kinds::literl_kind,
       my_symbols<symb_kinds::literl_kind>::syms::literl0>> > > > >
  >::attr_expr<texpressions<my_symbols>::op_symb<symb_kinds::literl_kind,
       my_symbols<symb_kinds::literl_kind>::syms::literl1>>, texpressions<my_symbols>::gram_defs<my_attrs,
composite_storage::type_sequence<texpressions<my_symbols>::gram_def1<my_symbols<symb_kinds::varble_kind>::syms::varble0,
       def_ops::def_act, composite_storage::top (), var_ptr_bool::var_ptr_yes,
texpressions<my_symbols>::gram_expr<op_assoc<ops_non_nullary::op_bitor, associativity::assoc_left>,
texpressions<my_symbols>::gram_expr<texpressions<my_symbols>::op_symb<symb_kinds::literl_kind,
       my_symbols<symb_kinds::literl_kind>::syms::literl0>>,
texpressions<my_symbols>::gram_expr<op_assoc<ops_non_nullary::op_bitand, associativity::assoc_left>,
texpressions<my_symbols>::gram_expr<texpressions<my_symbols>::op_symb<symb_kinds::literl_kind,
       my_symbols<symb_kinds::literl_kind>::syms::literl1>>,
texpressions<my_symbols>::gram_expr<texpressions<my_symbols>::op_symb<symb_kinds::literl_kind,
       my_symbols<symb_kinds::literl_kind>::syms::literl0>> > > > >
  >::attr_expr<texpressions<my_symbols>::op_symb<symb_kinds::literl_kind,
       my_symbols<symb_kinds::literl_kind>::syms::literl0>> > >'
                     now_index=DefNow::now_t::size-num_rands;
                                              ^
./texpressions.hpp:1150:19: note: in instantiation of function template specialization
       'texpressions<my_symbols>::gram_defs<my_attrs,
composite_storage::type_sequence<texpressions<my_symbols>::gram_def1<my_symbols<symb_kinds::varble_kind>::syms::varble0,
       def_ops::def_act, composite_storage::top (), var_ptr_bool::var_ptr_yes,
texpressions<my_symbols>::gram_expr<op_assoc<ops_non_nullary::op_bitor, associativity::assoc_left>,
texpressions<my_symbols>::gram_expr<texpressions<my_symbols>::op_symb<symb_kinds::literl_kind,
       my_symbols<symb_kinds::literl_kind>::syms::literl0>>,
texpressions<my_symbols>::gram_expr<op_assoc<ops_non_nullary::op_bitand, associativity::assoc_left>,
texpressions<my_symbols>::gram_expr<texpressions<my_symbols>::op_symb<symb_kinds::literl_kind,
       my_symbols<symb_kinds::literl_kind>::syms::literl1>>,
texpressions<my_symbols>::gram_expr<texpressions<my_symbols>::op_symb<symb_kinds::literl_kind,
       my_symbols<symb_kinds::literl_kind>::syms::literl0>> > > > > >::read_fold_from<ops_non_nullary::op_bitor,
       iter_range<my_symbols<symb_kinds::literl_kind>::syms,
inp_out_type<my_symbols<symb_kinds::literl_kind>::syms>::out_type>, def_now_t,
texpressions<my_symbols>::gram_expr<texpressions<my_symbols>::op_symb<symb_kinds::literl_kind,
       my_symbols<symb_kinds::literl_kind>::syms::literl0>>,
texpressions<my_symbols>::gram_expr<op_assoc<ops_non_nullary::op_bitand, associativity::assoc_left>,
texpressions<my_symbols>::gram_expr<texpressions<my_symbols>::op_symb<symb_kinds::literl_kind,
       my_symbols<symb_kinds::literl_kind>::syms::literl1>>,
texpressions<my_symbols>::gram_expr<texpressions<my_symbols>::op_symb<symb_kinds::literl_kind,
       my_symbols<symb_kinds::literl_kind>::syms::literl0>> > >' requested here
                   read_fold_from
                   ^

As you can see from the output, there's only *one* level of indentation when several levels, reflecting the tree structure, are what I expected.

How do I get the expected indentation?

TIA.

-regards,
Larry

Hi Larry,

Right now, the template type diffing only works when there are two templated types in the diagnostics message, and the templated types share the same base. It your first example, the two types are vector and vector.

In the second error message, only one type is printed with the diagnostic message. This does not trigger the template type diffing. The first message is “no member named ‘size’ in <>” and the second message is “in instantiation of function template specialization <> requested here”

Richard

Thanks Richard.

That's too bad. It finally dawned on me that I might could use
clang-format on the part of the error message I wanted indented.
It worked:

~/prog_dev/clang/libcxx/sandbox/libs/gram_stk/sandbox $ head test.cpp
texpressions<my_symbols>::gram_defs<my_attrs,
composite_storage::type_sequence<texpressions<my_symbols>::gram_def1<my_symbols<symb_kinds::varble_kind>::syms::varble0,
       def_ops::def_act, composite_storage::top (), var_ptr_bool::var_ptr_yes,
texpressions<my_symbols>::gram_expr<op_assoc<ops_non_nullary::op_bitor, associativity::assoc_left>,
texpressions<my_symbols>::gram_expr<texpressions<my_symbols>::op_symb<symb_kinds::literl_kind,
       my_symbols<symb_kinds::literl_kind>::syms::literl0>>,
texpressions<my_symbols>::gram_expr<op_assoc<ops_non_nullary::op_bitand, associativity::assoc_left>,
texpressions<my_symbols>::gram_expr<texpressions<my_symbols>::op_symb<symb_kinds::literl_kind,
       my_symbols<symb_kinds::literl_kind>::syms::literl1>>,
texpressions<my_symbols>::gram_expr<texpressions<my_symbols>::op_symb<symb_kinds::literl_kind,
~/prog_dev/clang/libcxx/sandbox/libs/gram_stk/sandbox $ clang-format test.cpp|head
Can't find usable .clang-format, using LLVM style
texpressions<my_symbols>::gram_defs<
     my_attrs,
     composite_storage::type_sequence<texpressions<my_symbols>::gram_def1<
         my_symbols<symb_kinds::varble_kind>::syms::varble0, def_ops::def_act,
         composite_storage::top(), var_ptr_bool::var_ptr_yes,
         texpressions<my_symbols>::gram_expr<
             op_assoc<ops_non_nullary::op_bitor, associativity::assoc_left>,
             texpressions<my_symbols>::gram_expr<
                 texpressions<my_symbols>::op_symb<
~/prog_dev/clang/libcxx/sandbox/libs/gram_stk/sandbox $

Hope that helps others which have similar problem deciphering
error messages :wink:

-regards,
Larry

Hi Larry,

Right now, the template type diffing only works when there are two
templated types in the diagnostics message, and the templated types
share the same base. It your first example, the two types are
vector<double> and vector<float>.

In the second error message, only one type is printed with the
diagnostic message. This does not trigger the template type diffing.
The first message is "no member named 'size' in <<very long type name>>"
and the second message is "in instantiation of function template
specialization <<long type name>> requested here"

Richard

Thanks Richard.

That's too bad. It finally dawned on me that I might could use
clang-format on the part of the error message I wanted indented.
It worked:

OOPS. I was very mistaken. I jumped to the conclusion based
on only a brief look at the output which only seemed to
show tree-like indentation. When I tried using
clang-format on the templed test.cpp, it showed no tree like output :frowning:

I guess I could make a feature request for this type of tree-link
output in the clang diagnostic, a feature which I've wanted for
several years and I think would help people better understand
complicated template diagnostics.

Sorry for noise.