Commit 949aab19 by Jakub Jelinek Committed by Jakub Jelinek

re PR c++/84843 (C++ ICE on builtin redefinition since r258391)

	PR c++/84843
	* decl.c (duplicate_decls): For redefinition of built-in, use error
	and return error_mark_node.  For redeclaration, return error_mark_node
	rather than olddecl if !flag_permissive.

	* g++.dg/ext/pr84843-1.C: New test.
	* g++.dg/ext/pr84843-2.C: New test.

From-SVN: r258503
parent 515f874f
2018-03-13 Jakub Jelinek <jakub@redhat.com>
PR c++/84843
* decl.c (duplicate_decls): For redefinition of built-in, use error
and return error_mark_node. For redeclaration, return error_mark_node
rather than olddecl if !flag_permissive.
2018-03-13 Jason Merrill <jason@redhat.com>
PR c++/82565 - ICE with concepts and generic lambda.
......
......@@ -1583,13 +1583,20 @@ next_arg:;
|| memcmp (name + len - strlen ("_chk"),
"_chk", strlen ("_chk") + 1) != 0))
{
if (DECL_INITIAL (newdecl))
{
error_at (DECL_SOURCE_LOCATION (newdecl),
"definition of %q#D ambiguates built-in "
"declaration %q#D", newdecl, olddecl);
return error_mark_node;
}
if (permerror (DECL_SOURCE_LOCATION (newdecl),
"new declaration %q#D ambiguates built-in"
" declaration %q#D", newdecl, olddecl)
&& flag_permissive)
inform (DECL_SOURCE_LOCATION (newdecl),
"ignoring the %q#D declaration", newdecl);
return olddecl;
return flag_permissive ? olddecl : error_mark_node;
}
}
......
2018-03-13 Jakub Jelinek <jakub@redhat.com>
PR c++/84843
* g++.dg/ext/pr84843-1.C: New test.
* g++.dg/ext/pr84843-2.C: New test.
2018-03-13 David Pagan <dave.pagan@oracle.com>
PR c/46921
......
// PR c++/84843
// { dg-do compile }
// { dg-options "-fpermissive" }
extern "C" int
__atomic_compare_exchange (int x, int y) // { dg-error "ambiguates built-in declaration" }
{
return x + y;
}
// PR c++/84843
// { dg-do compile }
// { dg-options "" }
extern "C" int
__atomic_compare_exchange (int x, int y) // { dg-error "ambiguates built-in declaration" }
{
return x + y;
}
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