For some reason, cp_parser_name_lookup_error uses %E for printing the
parsing scope, so dump_expr needs to know how to handle some _TYPEs.
DECLTYPE_TYPE was missing.

Tested x86_64-pc-linux-gnu, applying to trunk.
commit 4d380464839058b3d70e1262339ed973642d6741
Author: Jason Merrill <ja...@redhat.com>
Date:   Mon Apr 9 16:51:01 2018 -0400

            PR c++/85279 - dump_expr doesn't understand decltype.
    
            * error.c (dump_expr): Handle DECLTYPE_TYPE.

diff --git a/gcc/cp/error.c b/gcc/cp/error.c
index 75e853a1428..f27b700a434 100644
--- a/gcc/cp/error.c
+++ b/gcc/cp/error.c
@@ -2714,6 +2714,7 @@ dump_expr (cxx_pretty_printer *pp, tree t, int flags)
     case INTEGER_TYPE:
     case COMPLEX_TYPE:
     case VECTOR_TYPE:
+    case DECLTYPE_TYPE:
       pp_type_specifier_seq (pp, t);
       break;
 
diff --git a/gcc/testsuite/g++.dg/cpp0x/decltype67.C b/gcc/testsuite/g++.dg/cpp0x/decltype67.C
new file mode 100644
index 00000000000..e8042ac59e7
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/decltype67.C
@@ -0,0 +1,7 @@
+// PR c++/85279
+// { dg-do compile { target c++11 } }
+
+template<typename T> struct A
+{
+  void foo(decltype(T())::Y);	// { dg-error {decltype\(T\(\)\)::Y} }
+};

Reply via email to