This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

C++: Anticipated declaration of builtins.

Hi Gaby,

> 1) Shouldn't we pre-declare the function at global scope, then
>    do a using-declaration at the standard scope?

The problem here is that they need to be treated as two independent
pre-declarations.  If a prototype or declaration is given for
one, it does not automatically anticipate/declare the other.  Hence,
we require separate DECLs with independent DECL_ANTICIPATED flags.

Similarly, the user-provided declaration/prototype in one namespace
could be compatible with the predeclared type, and hence use the
builtin's functionality, but the declaration given in the other
namespace incompatible, overrides the anticipated functionality
and providing it's own definition, DECL_RTL, etc...

> 2) Why doesn't the second call to builtin_function_1() specify
>    global_namespace instead of NULL_TREE?  I think specifying
>    global_namespace should be the way to go.  What I am missing?

For this I have no good answer.  The original code used NULL_TREE
when I added the additional call to also anticipate the declaration
in the std:: namespace.  I've no problem with you changing it if
that's more correct thing to do, and it passes regression checking.

I hope this helps,

Roger Sayle,                         E-mail:
OpenEye Scientific Software,         WWW:
Suite 1107, 3600 Cerrillos Road,     Tel: (+1) 505-473-7385
Santa Fe, New Mexico, 87507.         Fax: (+1) 505-473-0833

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]