This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [C++ PATCH] Fix extern "C" function and namespace handling
On 07 Oct 2000 at 23:08 (-0700), Kriang Lerdsuwanakij wrote:
|
| On Sat, 7 Oct 2000 brent@rcfile.org wrote:
|
| > the attached patch to cp/decl2.c allows the code above to compile.
| > I'm not sure if it is sane, but I'll throw it in the mix. basically,
| > all I did was reverse the order of the tests in
| > do_nonmember_using_decl() to allow the duplicate_decls() case to break
| > before testing the overloaded function.
| >
| > brent
| >
|
| I have tested your patch. I believe the approach in the patch is
| correct.
FWIW, the following code is still busted after both patches applied.
AFAICT, it looks like another test will have to be added to
do_nonmember_using_decl() to accomodate this, what are your
(group-at-large, also) thoughts on this approach?
thanks.
brent
namespace _C_ {
extern "C" int abs(int a);
}
namespace std {
inline int abs(int a){ return a >= 0 ? a : - a; } // error
inline long abs(long a){ return a >= 0 ? a : - a; } // OK
}
using namespace std // OK
using std::abs; // error
int main()
{
using std::abs; // OK
abs(5);
return 0;
}
--
All opinions expressed are My own, unless otherwise attributed. In
presenting facts, I expressly reserve the right to be Wrong. Portions
of this message authored by Me are subject to the Free Thought License.