commit 1ba7cf95c0b024c7a3372e0734d7bf620f31dd14
Author: Jason Merrill <jason@redhat.com>
Date: Mon Jun 30 12:08:09 2014 -0400
PR c++/61566
* mangle.c (decl_mangling_context): Look through a TEMPLATE_DECL.
@@ -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)))
{
new file mode 100644
@@ -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);
+}