Commit 4d24a889 by Nathan Sidwell Committed by Nathan Sidwell

decl2.c (do_nonmember_using_decl): Don't complain if we find same function.

cp:
	* decl2.c (do_nonmember_using_decl): Don't complain if we find
	same function. Do complain about ambiguating extern "C"
	declarations.
testsuite:
	* g++.old-deja/g++.other/using9.C: New test.

From-SVN: r40148
parent 1abdf5e7
2001-03-01 Nathan Sidwell <nathan@codesourcery.com>
* decl2.c (do_nonmember_using_decl): Don't complain if we find
same function. Do complain about ambiguating extern "C"
declarations.
2001-02-28 Nathan Sidwell <nathan@codesourcery.com>
Remove floating point and complex type template constant parms.
......
......@@ -5126,22 +5126,21 @@ do_nonmember_using_decl (scope, name, oldval, oldtype, newval, newtype)
{
tree old_fn = OVL_CURRENT (tmp1);
if (!OVL_USED (tmp1)
&& compparms (TYPE_ARG_TYPES (TREE_TYPE (new_fn)),
TYPE_ARG_TYPES (TREE_TYPE (old_fn))))
if (new_fn == old_fn)
/* The function already exists in the current namespace. */
break;
else if (OVL_USED (tmp1))
continue; /* this is a using decl */
else if (compparms (TYPE_ARG_TYPES (TREE_TYPE (new_fn)),
TYPE_ARG_TYPES (TREE_TYPE (old_fn))))
{
if (!(DECL_EXTERN_C_P (new_fn)
&& DECL_EXTERN_C_P (old_fn)))
/* There was already a non-using declaration in
this scope with the same parameter types. */
cp_error ("`%D' is already declared in this scope",
name);
/* There was already a non-using declaration in
this scope with the same parameter types. If both
are the same extern "C" functions, that's ok. */
if (!decls_match (new_fn, old_fn))
cp_error ("`%D' is already declared in this scope", name);
break;
}
else if (duplicate_decls (new_fn, old_fn))
/* We're re-using something we already used
before. We don't need to add it again. */
break;
}
/* If we broke out of the loop, there's no reason to add
......
2001-03-01 Nathan Sidwell <nathan@codesourcery.com>
* g++.old-deja/g++.other/using9.C: New test.
2001-02-28 Ovidiu Predescu <ovidiu@cup.hp.com>
* objc/execute/bycopy-3.m: Added new test from Nicola Pero.
......
// Build don't link:
//
// Copyright (C) 2000 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 26 Feb 2001 <nathan@codesourcery.com>
// Bug 75. using declarations cannot introduce functions which ambiguate
// those in the current namespace, BUT here we're reaccessing the current
// namespace -- the function is not being 'introduced'.
extern int a();
struct x {};
using ::x;
using ::a;
extern "C" void foo ();
namespace {
extern "C" int foo ();
using ::foo; // ERROR - already in use
}
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