This PR compains about ugly diagnostics where we print template argument '2' does not match '#'integer_cst' not supported by dump_decl#<declaration error>' The following patch teaches dump_decl how to print constants properly.
Bootstrapped/regtested on x86_64-linux, ok for trunk? 2016-05-19 Marek Polacek <pola...@redhat.com> PR c++/71075 * error.c (dump_decl): Handle *_CST. * g++.dg/diagnostic/pr71075.C: New test. diff --git gcc/cp/error.c gcc/cp/error.c index 7d70f89..d3232bd 100644 --- gcc/cp/error.c +++ gcc/cp/error.c @@ -1269,6 +1269,14 @@ dump_decl (cxx_pretty_printer *pp, tree t, int flags) dump_type (pp, t, flags); break; + case VOID_CST: + case INTEGER_CST: + case REAL_CST: + case STRING_CST: + case COMPLEX_CST: + pp->constant (t); + break; + default: pp_unsupported_tree (pp, t); /* Fall through to error. */ diff --git gcc/testsuite/g++.dg/diagnostic/pr71075.C gcc/testsuite/g++.dg/diagnostic/pr71075.C index e69de29..6bb1e68 100644 --- gcc/testsuite/g++.dg/diagnostic/pr71075.C +++ gcc/testsuite/g++.dg/diagnostic/pr71075.C @@ -0,0 +1,8 @@ +// PR c++/71075 + +template<typename T, int I> struct A {}; +template<typename T> void foo(A<T,1>) {} +int main() { + foo(A<int,2>()); // { dg-error "no matching" } +// { dg-message "template argument .2. does not match .1." "" { target *-*-* } 6 } +} Marek