re PR c++/49276 ([C++0x] Segmentation fault with default lambda parameter in member...
authorJakub Jelinek <jakub@redhat.com>
Fri, 3 Jun 2011 20:19:42 +0000 (22:19 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Fri, 3 Jun 2011 20:19:42 +0000 (22:19 +0200)
PR c++/49276
* mangle.c (write_nested_name): Use CP_DECL_CONTEXT instead of
DECL_CONTEXT.

* g++.dg/cpp0x/lambda/lambda-mangle2.C: New test.

From-SVN: r174619

gcc/cp/ChangeLog
gcc/cp/mangle.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/cpp0x/lambda/lambda-mangle2.C [new file with mode: 0644]

index b53331d5da1bdc0a4c2616eaf1b0fdb8e861a840..2e70bc6d141612406e1faea8e9f46ed094eff7de 100644 (file)
@@ -1,3 +1,9 @@
+2011-06-03  Jakub Jelinek  <jakub@redhat.com>
+
+       PR c++/49276
+       * mangle.c (write_nested_name): Use CP_DECL_CONTEXT instead of
+       DECL_CONTEXT.
+
 2011-06-01  Jason Merrill  <jason@redhat.com>
 
        * pt.c (build_non_dependent_expr): Remove special handling of
index 7ecfefb3b804f87758efdb2ade7147da1ed55343..134c9ea7f199e1cefcecc8bd6fffff9a67483c7a 100644 (file)
@@ -1,6 +1,6 @@
 /* Name mangling for the 3.0 C++ ABI.
-   Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008, 2009, 2010
-   Free Software Foundation, Inc.
+   Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008, 2009, 2010,
+   2011  Free Software Foundation, Inc.
    Written by Alex Samuel <samuel@codesourcery.com>
 
    This file is part of GCC.
@@ -943,7 +943,7 @@ write_nested_name (const tree decl)
   else
     {
       /* No, just use <prefix>  */
-      write_prefix (DECL_CONTEXT (decl));
+      write_prefix (CP_DECL_CONTEXT (decl));
       write_unqualified_name (decl);
     }
   write_char ('E');
index 91bed17a4c711b1d07340948e77dca328f96db77..781d7526230c265ff6283448968a523f977753cc 100644 (file)
@@ -1,3 +1,8 @@
+2011-06-03  Jakub Jelinek  <jakub@redhat.com>
+
+       PR c++/49276
+       * g++.dg/cpp0x/lambda/lambda-mangle2.C: New test.
+
 2011-06-03  Nicola Pero  <nicola.pero@meta-innovation.com>
 
        * objc.dg/headers.m: Do not include sarray.h and hash.h.
diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-mangle2.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-mangle2.C
new file mode 100644 (file)
index 0000000..4b7d15a
--- /dev/null
@@ -0,0 +1,21 @@
+// PR c++/49276
+// { dg-do compile }
+// { dg-options "-std=c++0x" }
+
+template <int N>
+struct F
+{
+  template <typename U> F (U);
+};
+
+struct S
+{
+  void foo (F <0> x = [] {}) {}
+};
+
+int
+main ()
+{
+  S s;
+  s.foo ();
+}