Commit 32314c38 by Paolo Carlini Committed by Paolo Carlini

re PR c++/58582 ([c++11] ICE defining and instantiating deleted template function)

/cp
2014-05-03  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/58582
	* decl.c (grokfndecl): Check duplicate_decls return value for
	error_mark_node.
	* pt.c (instantiate_decl): A deleted function is defined.

/testsuite
2014-05-03  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/58582
	* g++.dg/cpp0x/deleted4.C: New.
	* g++.dg/cpp0x/deleted5.C: Likewise.
	* g++.dg/cpp0x/deleted6.C: Likewise.

From-SVN: r210043
parent 579f4e64
2014-05-03 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/58582
* decl.c (grokfndecl): Check duplicate_decls return value for
error_mark_node.
* pt.c (instantiate_decl): A deleted function is defined.
2014-05-02 Jason Merrill <jason@redhat.com> 2014-05-02 Jason Merrill <jason@redhat.com>
* decl2.c (vague_linkage_p): Local statics have vague linkage. * decl2.c (vague_linkage_p): Local statics have vague linkage.
......
...@@ -7822,6 +7822,8 @@ grokfndecl (tree ctype, ...@@ -7822,6 +7822,8 @@ grokfndecl (tree ctype,
decl, ctype); decl, ctype);
return NULL_TREE; return NULL_TREE;
} }
if (ok == error_mark_node)
return NULL_TREE;
return old_decl; return old_decl;
} }
} }
......
...@@ -19620,7 +19620,8 @@ instantiate_decl (tree d, int defer_ok, ...@@ -19620,7 +19620,8 @@ instantiate_decl (tree d, int defer_ok,
if (TREE_CODE (d) == FUNCTION_DECL) if (TREE_CODE (d) == FUNCTION_DECL)
pattern_defined = (DECL_SAVED_TREE (code_pattern) != NULL_TREE pattern_defined = (DECL_SAVED_TREE (code_pattern) != NULL_TREE
|| DECL_DEFAULTED_OUTSIDE_CLASS_P (code_pattern)); || DECL_DEFAULTED_OUTSIDE_CLASS_P (code_pattern)
|| DECL_DELETED_FN (code_pattern));
else else
pattern_defined = ! DECL_IN_AGGR_P (code_pattern); pattern_defined = ! DECL_IN_AGGR_P (code_pattern);
...@@ -19862,6 +19863,8 @@ instantiate_decl (tree d, int defer_ok, ...@@ -19862,6 +19863,8 @@ instantiate_decl (tree d, int defer_ok,
tf_warning_or_error, tmpl, tf_warning_or_error, tmpl,
/*integral_constant_expression_p=*/false); /*integral_constant_expression_p=*/false);
if (DECL_STRUCT_FUNCTION (code_pattern))
{
/* Set the current input_location to the end of the function /* Set the current input_location to the end of the function
so that finish_function knows where we are. */ so that finish_function knows where we are. */
input_location input_location
...@@ -19871,6 +19874,7 @@ instantiate_decl (tree d, int defer_ok, ...@@ -19871,6 +19874,7 @@ instantiate_decl (tree d, int defer_ok,
current_function_infinite_loop current_function_infinite_loop
= DECL_STRUCT_FUNCTION (code_pattern)->language->infinite_loop; = DECL_STRUCT_FUNCTION (code_pattern)->language->infinite_loop;
} }
}
/* We don't need the local specializations any more. */ /* We don't need the local specializations any more. */
pointer_map_destroy (local_specializations); pointer_map_destroy (local_specializations);
......
2014-05-03 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/58582
* g++.dg/cpp0x/deleted4.C: New.
* g++.dg/cpp0x/deleted5.C: Likewise.
* g++.dg/cpp0x/deleted6.C: Likewise.
2014-05-03 Dominique d'Humieres <dominiq@lps.ens.fr> 2014-05-03 Dominique d'Humieres <dominiq@lps.ens.fr>
PR fortran/61025 PR fortran/61025
......
// PR c++/58582
// { dg-do compile { target c++11 } }
struct A
{
template<int> void foo() = delete;
};
template<int> void A::foo() { int i; } // { dg-error "redefinition" }
template void A::foo<0>();
// PR c++/58582
// { dg-do compile { target c++11 } }
struct A
{
template<int> void foo() = delete;
};
template<int> void A::foo() {} // { dg-error "redefinition" }
template void A::foo<0>();
// PR c++/58582
// { dg-do compile { target c++11 } }
struct A
{
template<int> void foo() = delete;
};
template void A::foo<0>();
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