aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2012-01-11 15:26:44 -0500
committerJason Merrill <jason@gcc.gnu.org>2012-01-11 15:26:44 -0500
commitb34e0e6fc844922bcd84583fc8dbaa0669afa5c0 (patch)
treeaaa92595e280011c55e0c1bb7d361c882256dbc7 /gcc
parentfaf00d3c168bc4cc7f50f5580216e854e62e51e3 (diff)
downloadgcc-b34e0e6fc844922bcd84583fc8dbaa0669afa5c0.zip
gcc-b34e0e6fc844922bcd84583fc8dbaa0669afa5c0.tar.gz
gcc-b34e0e6fc844922bcd84583fc8dbaa0669afa5c0.tar.bz2
re PR c++/51818 ([C++0x] Name mangling error using lambda expressions in GCC47)
PR c++/51818 * mangle.c (find_substitution): A type is only a substitution match if we're looking for a type. (write_nested_name): Use decl_mangling_context. From-SVN: r183107
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog5
-rw-r--r--gcc/cp/mangle.c4
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/lambda/lambda-mangle3.C15
4 files changed, 27 insertions, 2 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 8893880..6850778 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,5 +1,10 @@
2012-01-11 Jason Merrill <jason@redhat.com>
+ PR c++/51818
+ * mangle.c (find_substitution): A type is only a substitution
+ match if we're looking for a type.
+ (write_nested_name): Use decl_mangling_context.
+
* decl.c (decls_match): Assert that the arguments are decls.
PR c++/51613
diff --git a/gcc/cp/mangle.c b/gcc/cp/mangle.c
index f4efa67..60b1870 100644
--- a/gcc/cp/mangle.c
+++ b/gcc/cp/mangle.c
@@ -615,7 +615,7 @@ find_substitution (tree node)
/* NODE is a matched to a candidate if it's the same decl node or
if it's the same type. */
if (decl == candidate
- || (TYPE_P (candidate) && type && TYPE_P (type)
+ || (TYPE_P (candidate) && type && TYPE_P (node)
&& same_type_p (type, candidate))
|| NESTED_TEMPLATE_MATCH (node, candidate))
{
@@ -949,7 +949,7 @@ write_nested_name (const tree decl)
else
{
/* No, just use <prefix> */
- write_prefix (CP_DECL_CONTEXT (decl));
+ write_prefix (decl_mangling_context (decl));
write_unqualified_name (decl);
}
write_char ('E');
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index f49cdd9..0d5b596 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2012-01-11 Jason Merrill <jason@redhat.com>
+
+ PR c++/51818
+ * g++.dg/cpp0x/lambda/lambda-mangle3.C: New.
+
2012-01-11 Eric Botcazou <ebotcazou@adacore.com>
* gnat.dg/array19.ad[sb]: New test.
diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-mangle3.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-mangle3.C
new file mode 100644
index 0000000..06913a1
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-mangle3.C
@@ -0,0 +1,15 @@
+// PR c++/51818
+// { dg-options -std=c++0x }
+// { dg-final { scan-assembler "_ZN1AC1IN3foo3barMUlvE_EEET_" } }
+
+struct A
+{
+ template <class T> A(T) { }
+};
+
+struct foo
+{
+ A bar = []{};
+};
+
+foo f;