* error.c (dump_expr): Print type of CONSTRUCTOR.
authorJason Merrill <jason@redhat.com>
Fri, 6 Jan 2012 21:39:19 +0000 (16:39 -0500)
committerJason Merrill <jason@gcc.gnu.org>
Fri, 6 Jan 2012 21:39:19 +0000 (16:39 -0500)
From-SVN: r182967

gcc/cp/ChangeLog
gcc/cp/error.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/cpp0x/error7.C [new file with mode: 0644]

index e6ea3bf..3f77f1b 100644 (file)
@@ -1,3 +1,7 @@
+2012-01-06  Jason Merrill  <jason@redhat.com>
+
+       * error.c (dump_expr): Print type of CONSTRUCTOR.
+
 2012-01-05  Dodji Seketeli  <dodji@redhat.com>
 
        PR c++/51541
index 21d6781..62b47ca 100644 (file)
@@ -2194,6 +2194,8 @@ dump_expr (tree t, int flags)
        }
       else
        {
+         if (!BRACE_ENCLOSED_INITIALIZER_P (t))
+           dump_type (TREE_TYPE (t), 0);
          pp_cxx_left_brace (cxx_pp);
          dump_expr_init_vec (CONSTRUCTOR_ELTS (t), flags);
          pp_cxx_right_brace (cxx_pp);
index aeef955..3f46fed 100644 (file)
@@ -1,3 +1,7 @@
+2012-01-06  Jason Merrill  <jason@redhat.com>
+
+       * g++.dg/cpp0x/error7.C: New.
+
 2012-01-06  Tobias Burnus <burnus@net-b.de>
 
        * gfortran.dg/deallocate_stat_2.f90: New.
diff --git a/gcc/testsuite/g++.dg/cpp0x/error7.C b/gcc/testsuite/g++.dg/cpp0x/error7.C
new file mode 100644 (file)
index 0000000..0dfbf9f
--- /dev/null
@@ -0,0 +1,10 @@
+// Test for printing the type of T{} in error messages.
+// { dg-options -std=c++0x }
+
+template <class T, T t> struct A { };
+template <class T> A<T,T{}> f(T t); // { dg-message "T{}" }
+
+int main()
+{
+  f();                         // { dg-error "no match" }
+}