Commit e3beb191 by Paolo Carlini Committed by Paolo Carlini

re PR c++/79361 (ICE redefining a template function as defaulted or deleted)

/cp
2017-02-23  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/79361
	* pt.c (register_specialization): Check duplicate_decls return value
	for error_mark_node and pass it back.

/testsuite
2017-02-23  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/79361
	* g++.dg/cpp0x/pr79361-1.C: New.
	* g++.dg/cpp0x/pr79361-2.C: Likewise.

From-SVN: r245692
parent 195610aa
2017-02-23 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/79361
* pt.c (register_specialization): Check duplicate_decls return value
for error_mark_node and pass it back.
2017-02-22 Jason Merrill <jason@redhat.com> 2017-02-22 Jason Merrill <jason@redhat.com>
PR c++/79679 - missing destructor for argument PR c++/79679 - missing destructor for argument
......
...@@ -1599,7 +1599,12 @@ register_specialization (tree spec, tree tmpl, tree args, bool is_friend, ...@@ -1599,7 +1599,12 @@ register_specialization (tree spec, tree tmpl, tree args, bool is_friend,
} }
else if (DECL_TEMPLATE_SPECIALIZATION (fn)) else if (DECL_TEMPLATE_SPECIALIZATION (fn))
{ {
if (!duplicate_decls (spec, fn, is_friend) && DECL_INITIAL (spec)) tree dd = duplicate_decls (spec, fn, is_friend);
if (dd == error_mark_node)
/* We've already complained in duplicate_decls. */
return error_mark_node;
if (dd == NULL_TREE && DECL_INITIAL (spec))
/* Dup decl failed, but this is a new definition. Set the /* Dup decl failed, but this is a new definition. Set the
line number so any errors match this new line number so any errors match this new
definition. */ definition. */
......
2017-02-23 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/79361
* g++.dg/cpp0x/pr79361-1.C: New.
* g++.dg/cpp0x/pr79361-2.C: Likewise.
2017-02-23 Eric Botcazou <ebotcazou@adacore.com> 2017-02-23 Eric Botcazou <ebotcazou@adacore.com>
* gcc.target/visium/bit_test.c: Accept any lsr form. * gcc.target/visium/bit_test.c: Accept any lsr form.
......
// PR c++/79361
// { dg-do compile { target c++11 } }
template<typename T> void foo(T);
template<> void foo<int>(int) {} // { dg-message "declared" }
template<> void foo<int>(int) = delete; // { dg-error "redefinition" }
// PR c++/79361
// { dg-do compile { target c++11 } }
template<typename T> void foo(T);
template<> void foo<int>(int) {} // { dg-message "declared" }
template<> void foo<int>(int) = default; // { dg-error "redefinition" }
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