aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp
diff options
context:
space:
mode:
authorMark Mitchell <mark@codesourcery.com>2003-03-11 23:07:45 +0000
committerMark Mitchell <mmitchel@gcc.gnu.org>2003-03-11 23:07:45 +0000
commit0c33daffa33ccd49807e44865b6d96d79c74cfe8 (patch)
treebfe14107f93101ea73e570388f5c16bb7b9e69f1 /gcc/cp
parentcf237c199cde6ed297fcf41bc6ea2a6a9723387a (diff)
downloadgcc-0c33daffa33ccd49807e44865b6d96d79c74cfe8.zip
gcc-0c33daffa33ccd49807e44865b6d96d79c74cfe8.tar.gz
gcc-0c33daffa33ccd49807e44865b6d96d79c74cfe8.tar.bz2
re PR c++/9924 (Multiple using statements for builtin functions not allowed)
PR c++/9924 * g++.dg/overload/builtin2.C: New test. 2003-03-11 Mark Mitchell <mark@codesourcery.com> PR c++/9924 * decl2.c (do_nonmember_using_decl): Ignore anticipated builtins. From-SVN: r64197
Diffstat (limited to 'gcc/cp')
-rw-r--r--gcc/cp/ChangeLog5
-rw-r--r--gcc/cp/decl2.c30
2 files changed, 23 insertions, 12 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 679cd11..9dcd1c7 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,8 @@
+2003-03-11 Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/9924
+ * decl2.c (do_nonmember_using_decl): Ignore anticipated builtins.
+
2003-03-11 Jason Merrill <jason@redhat.com>
PR c++/9820
diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c
index c2f1f6c..b96f65f 100644
--- a/gcc/cp/decl2.c
+++ b/gcc/cp/decl2.c
@@ -4251,21 +4251,27 @@ do_nonmember_using_decl (tree scope, tree name, tree oldval, tree oldtype,
else if (compparms (TYPE_ARG_TYPES (TREE_TYPE (new_fn)),
TYPE_ARG_TYPES (TREE_TYPE (old_fn))))
{
- /* If this using declaration introduces a function
- recognized as a built-in, no longer mark it as
- anticipated in this scope. */
- if (DECL_ANTICIPATED (old_fn))
- {
- DECL_ANTICIPATED (old_fn) = 0;
- break;
- }
-
/* 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))
- error ("`%D' is already declared in this scope", name);
- break;
+ if (decls_match (new_fn, old_fn))
+ {
+ /* If the OLD_FN was a builtin, there is now a
+ real declaration. */
+ if (DECL_ANTICIPATED (old_fn))
+ DECL_ANTICIPATED (old_fn) = 0;
+ break;
+ }
+ else if (!DECL_ANTICIPATED (old_fn))
+ {
+ /* If the OLD_FN was really declared, the
+ declarations don't match. */
+ error ("`%D' is already declared in this scope", name);
+ break;
+ }
+
+ /* If the OLD_FN was not really there, just ignore
+ it and keep going. */
}
}