]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR c++/44366 ([C++0x] g++ crashes when declaring a lambda expression using a typed...
authorJason Merrill <jason@redhat.com>
Tue, 8 Jun 2010 04:33:50 +0000 (00:33 -0400)
committerJason Merrill <jason@gcc.gnu.org>
Tue, 8 Jun 2010 04:33:50 +0000 (00:33 -0400)
PR c++/44366
* error.c (dump_parameters): Mask out TFF_SCOPE.
(dump_simple_decl): Don't print the scope of a PARM_DECL.
(dump_scope): Remove no-op mask.

From-SVN: r160420

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

index 77d7c5112695156a7614427a24c1f179e400018d..bf6833664cf0183124b07304ff9d486b21f6e9c7 100644 (file)
@@ -1,5 +1,10 @@
 2010-06-07  Jason Merrill  <jason@redhat.com>
 
+       PR c++/44366
+       * error.c (dump_parameters): Mask out TFF_SCOPE.
+       (dump_simple_decl): Don't print the scope of a PARM_DECL.
+       (dump_scope): Remove no-op mask.
+
        PR c++/44401
        * parser.c (cp_parser_lookup_name): Fix naming the constructor.
 
index d535f05a54d89b185a1646268d654b15073bac87..7730e4bb17ab2a8a48cb3d9b2837f4408e73057c 100644 (file)
@@ -115,7 +115,7 @@ init_error (void)
 static void
 dump_scope (tree scope, int flags)
 {
-  int f = ~TFF_RETURN_TYPE & (flags & (TFF_SCOPE | TFF_CHASE_TYPEDEF));
+  int f = flags & (TFF_SCOPE | TFF_CHASE_TYPEDEF);
 
   if (scope == NULL_TREE)
     return;
@@ -865,6 +865,7 @@ dump_simple_decl (tree t, tree type, int flags)
       pp_maybe_space (cxx_pp);
     }
   if (! (flags & TFF_UNQUALIFIED_NAME)
+      && TREE_CODE (t) != PARM_DECL
       && (!DECL_INITIAL (t)
          || TREE_CODE (DECL_INITIAL (t)) != TEMPLATE_PARM_INDEX))
     dump_scope (CP_DECL_CONTEXT (t), flags);
@@ -1355,6 +1356,7 @@ static void
 dump_parameters (tree parmtypes, int flags)
 {
   int first = 1;
+  flags &= ~TFF_SCOPE;
   pp_cxx_left_paren (cxx_pp);
 
   for (first = 1; parmtypes != void_list_node;
index a9b9c7a9c183c3b6acef531af7064ab2c94125ba..a32bcb0a853cf898516547a1c2094e42bc9406d0 100644 (file)
@@ -1,3 +1,8 @@
+2010-06-07  Jason Merrill  <jason@redhat.com>
+
+       PR c++/44366
+       * g++.dg/cpp0x/decltype23.C: New.
+
 2010-06-08  Andrew Pinski <pinskia@gmail.com>
            Shujing Zhao  <pearly.zhao@oracle.com>
        
diff --git a/gcc/testsuite/g++.dg/cpp0x/decltype23.C b/gcc/testsuite/g++.dg/cpp0x/decltype23.C
new file mode 100644 (file)
index 0000000..6d8dff9
--- /dev/null
@@ -0,0 +1,12 @@
+// PR c++/44366
+// While printing the operand of decltype We were trying to print f as the
+// scope of t, causing infinite recursion.
+// { dg-options "-std=c++0x" }
+
+template <typename T>
+void f(T t, decltype(*t))
+{
+  struct A { void g() {
+    foo;                       // { dg-error "foo" }
+  } };
+}