From e9b398aef87d9fb8a1ca8d777bb084d43cadf702 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Fri, 3 Jun 2011 22:19:42 +0200 Subject: [PATCH] re PR c++/49276 ([C++0x] Segmentation fault with default lambda parameter in member function) 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 | 6 ++++++ gcc/cp/mangle.c | 6 +++--- gcc/testsuite/ChangeLog | 5 +++++ .../g++.dg/cpp0x/lambda/lambda-mangle2.C | 21 +++++++++++++++++++ 4 files changed, 35 insertions(+), 3 deletions(-) create mode 100644 gcc/testsuite/g++.dg/cpp0x/lambda/lambda-mangle2.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index b53331d5da1..2e70bc6d141 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2011-06-03 Jakub Jelinek + + PR c++/49276 + * mangle.c (write_nested_name): Use CP_DECL_CONTEXT instead of + DECL_CONTEXT. + 2011-06-01 Jason Merrill * pt.c (build_non_dependent_expr): Remove special handling of diff --git a/gcc/cp/mangle.c b/gcc/cp/mangle.c index 7ecfefb3b80..134c9ea7f19 100644 --- a/gcc/cp/mangle.c +++ b/gcc/cp/mangle.c @@ -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 This file is part of GCC. @@ -943,7 +943,7 @@ write_nested_name (const tree decl) else { /* No, just use */ - write_prefix (DECL_CONTEXT (decl)); + write_prefix (CP_DECL_CONTEXT (decl)); write_unqualified_name (decl); } write_char ('E'); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 91bed17a4c7..781d7526230 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2011-06-03 Jakub Jelinek + + PR c++/49276 + * g++.dg/cpp0x/lambda/lambda-mangle2.C: New test. + 2011-06-03 Nicola Pero * 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 index 00000000000..4b7d15ad953 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-mangle2.C @@ -0,0 +1,21 @@ +// PR c++/49276 +// { dg-do compile } +// { dg-options "-std=c++0x" } + +template +struct F +{ + template F (U); +}; + +struct S +{ + void foo (F <0> x = [] {}) {} +}; + +int +main () +{ + S s; + s.foo (); +} -- 2.30.2