This is the mail archive of the
libstdc++@sources.redhat.com
mailing list for the libstdc++ project.
Re: [c++] builtin functions and namespaces
- To: brent at rcfile dot org
- Subject: Re: [c++] builtin functions and namespaces
- From: Martin von Loewis <loewis at informatik dot hu-berlin dot de>
- Date: Wed, 27 Sep 2000 16:39:02 +0200 (MET DST)
- CC: bkoz at redhat dot com, gcc-bugs at gcc dot gnu dot org, libstdc++ at sources dot redhat dot com, jason at cygnus dot com
- References: <200009261624.e8QGOtj19536@fillmore.constant.com> <20000926195501.A15158@rcfile.org>
> gcc/cp/call.c: build_new_function_call()
> which kicks the error because
> gcc/cp/call.c: tourney()
> returns 0 because
> gcc/cp/call.c: joust()
> returns 0 because joust can't decide whether to pick the
> ::std::__builtin_fn or ::__buitlin_fn as the better candidate
I believe it should have detected much earlier that they are indeed
the same function: when building the candidates list, duplicates are
eliminated. It would be best if ::fabs and std::fabs would be the same
DECL, which should have a DECL_CONTEXT of std:: (if std is honoured).
To achieve this, I believe cp/decl.c:builtin_function should put
*some* declarations into std::. Specifically, the __builtin_*
functions probably need to be globally visible, whereas the functions
mandated by the C++ standard's standard C library should be in std::.
To achieve this, additional classes (along with BUILT_IN_NORMAL)
might be needed, or builtin_function could do magic with looking at
the name of the function.
> A) in joust() to arbitrarily choose one when the functions differ
> only in CONTEXT_DECL? how would I verify this condition?
No! If that was done, it would do the wrong thing for
namespace Foo{
struct Bar{};
void foobar(Bar*);
}
void foobar(Foo::Bar*);
Calling foobar(new Foo::Bar) is ambiguous and must be reported as such.
> B) elsewhere to ensure that the the ::__builtin_fn is not a candidate
> at all. where would this be done?
It is ok if they are candidates - just not more than once.
> C) remove the gcc source from my box and take a real vacation :-)
Sounds like a good plan to me :=)
Regards,
Martin
P.S. As a side note: functions should be considered equivalent if they
have the same name and are both extern "C". I'm not sure whether this
is done correctly.