summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>2014-06-30 18:51:29 +0000
committerjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>2014-06-30 18:51:29 +0000
commit5e410273761a0a3bb1cece5c11b0f73efe70716f (patch)
tree0afc62b27294c1b4d7e94bac36e99f94358d3499
parentd93128cba6350bbfc6d9d5631bab90b9b7360fd7 (diff)
downloadgcc-5e410273761a0a3bb1cece5c11b0f73efe70716f.tar.gz
PR c++/61566
* mangle.c (decl_mangling_context): Look through a TEMPLATE_DECL. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@212165 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/cp/ChangeLog3
-rw-r--r--gcc/cp/mangle.c4
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/lambda/lambda-template13.C20
3 files changed, 27 insertions, 0 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index e925e133422..122cf8ada59 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,5 +1,8 @@
2014-06-30 Jason Merrill <jason@redhat.com>
+ PR c++/61566
+ * mangle.c (decl_mangling_context): Look through a TEMPLATE_DECL.
+
* decl.c (build_ptrmemfunc_type): Don't give a PMF RECORD_TYPE
TYPE_BINFO or TYPE_LANG_SPECIFIC.
* cp-tree.h (TYPE_PTRMEMFUNC_FLAG): Use TYPE_LANG_FLAG_2.
diff --git a/gcc/cp/mangle.c b/gcc/cp/mangle.c
index ac1c1da9730..02c05d47747 100644
--- a/gcc/cp/mangle.c
+++ b/gcc/cp/mangle.c
@@ -742,6 +742,10 @@ decl_mangling_context (tree decl)
if (tcontext != NULL_TREE)
return tcontext;
+ if (TREE_CODE (decl) == TEMPLATE_DECL
+ && DECL_TEMPLATE_RESULT (decl))
+ decl = DECL_TEMPLATE_RESULT (decl);
+
if (TREE_CODE (decl) == TYPE_DECL
&& LAMBDA_TYPE_P (TREE_TYPE (decl)))
{
diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-template13.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-template13.C
new file mode 100644
index 00000000000..adbb4dbcaac
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-template13.C
@@ -0,0 +1,20 @@
+// PR c++/61566
+// { dg-do compile { target c++11 } }
+
+struct function
+{
+ template < typename _Functor>
+ function (_Functor);
+};
+
+struct C
+{
+ template <typename T>
+ void foo (T, function = [] {});
+};
+
+void bar ()
+{
+ C c;
+ c.foo (1);
+}