https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65230
Bug ID: 65230 Summary: pretty-print inconsistent output for similar objects Product: gcc Version: 5.0 Status: UNCONFIRMED Severity: enhancement Priority: P3 Component: libstdc++ Assignee: unassigned at gcc dot gnu.org Reporter: msebor at gcc dot gnu.org The libstdc++ pretty printer produces inconsistent output for objects with similar properties, making it more difficult than necessary to interpret. For example, an "empty" bitset object (one consisting of no bits, or one with no bits set) is printed simply as "std::bitset" while an empty std::tuple<> is printed as "empty std::tuple". A std::vector<bool> of size 0 is printed to include its size and capacity, while a non-empty vector<bool> also includes its elements. An example is below. I'd like to propose that the value of an empty object be printed as "{ }" regardless of its type. I.e., a std::bitset<0> as "std::bitset { }", a std::tuple<> as "std::tuple<> { }", and an empty std::vector<T> as "std::vector<T> of length 0, capacity N = { }" $ g++ -g -std=c++11 t.cpp && gdb -batch -ex "b foo" -ex "r" -ex "p b0" -ex "p b1" -ex "p t0" -ex "p t1" -ex "p v0" -ex "p v1" -q a.out Breakpoint 1 at 0x100008a8: file t.cpp, line 9. Python Exception <class 'gdb.error'> There is no member or method named _M_w.: Breakpoint 1, foo(std::bitset<0ul>, std::bitset<1ul>, std::tuple<>, std::tuple<int>, std::vector<bool, std::allocator<bool> >, std::vector<bool, std::allocator<bool> >) (b0=std::bitset, b1=std::bitset, t0=empty std::tuple, t1=std::tuple containing = {...}, v0=std::vector<bool> of length 0, capacity 0, v1=std::vector<bool> of length 1, capacity 64 = {...}) at t.cpp:9 9 } Python Exception <class 'gdb.error'> There is no member or method named _M_w.: $1 = std::bitset $2 = std::bitset $3 = empty std::tuple $4 = std::tuple containing = {[1] = 0} $5 = std::vector<bool> of length 0, capacity 0 $6 = std::vector<bool> of length 1, capacity 64 = {0}