[PR c++/21087] don't keep builtin anticipated decl, override it with actual declaration

Alexandre Oliva aoliva@redhat.com
Tue Apr 19 21:45:00 GMT 2005


When push_overloaded_decl() was passed a new declaration that matches
a builtin decl, it would verify that the declarations matched and, if
so, leave the existing (built-in) declaration alone.

The intended behavior is to merge the built-in declaration with the
new declaration, into the location of the built-in declaration.

The problem is that duplicate_decl() doesn't perform such merging when
the new declaration is a template decl, and then we end up with an
overload involving the template decl and the anticipated built-in
decl.  However, overloads involving anticipated decls are something we
try to avoid, and actually check for elsewhere.

This patch fixes the code such that, if the existing decl is
anticipated and the two decls weren't merged, we discard the built-in
and use the new decl by itself.

Bootstrapped and regtested on amd64-linux-gnu.  Ok to install?

-------------- next part --------------
A non-text attachment was scrubbed...
Name: cp-push-over-decl-builtin.patch
Type: text/x-patch
Size: 1956 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20050419/688b6576/attachment.bin>
-------------- next part --------------

-- 
Alexandre Oliva             http://www.ic.unicamp.br/~oliva/
Red Hat Compiler Engineer   aoliva@{redhat.com, gcc.gnu.org}
Free Software Evangelist  oliva@{lsd.ic.unicamp.br, gnu.org}


More information about the Gcc-patches mailing list