Commit cae7c960 by Jason Merrill Committed by Jason Merrill

re PR c++/61566 (ICE in write_unscoped_name)

	PR c++/61566
	* mangle.c (decl_mangling_context): Look through a TEMPLATE_DECL.

From-SVN: r212165
parent 1d7e2ec7
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.
......
......@@ -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)))
{
......
// 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);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment