From 97ba1e3c395151689c93f4353f8eff1ce416b174 Mon Sep 17 00:00:00 2001 From: Mark Mitchell Date: Thu, 19 Oct 2000 17:57:49 +0000 Subject: [PATCH] cp-tree.h (DECL_ANTICIPATED): Don't require a FUNCTION_DECL. * cp-tree.h (DECL_ANTICIPATED): Don't require a FUNCTION_DECL. * decl.c (select_decl): Don't return declarations that are DECL_ANTICIPATED. From-SVN: r36953 --- gcc/cp/ChangeLog | 6 ++++++ gcc/cp/cp-tree.h | 2 +- gcc/cp/decl.c | 9 +++++++++ gcc/testsuite/g++.old-deja/g++.other/std1.C | 13 +++++++++++++ 4 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/g++.old-deja/g++.other/std1.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index f0fbee8d945..8c39273c6c8 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2000-10-19 Mark Mitchell + + * cp-tree.h (DECL_ANTICIPATED): Don't require a FUNCTION_DECL. + * decl.c (select_decl): Don't return declarations that are + DECL_ANTICIPATED. + 2000-10-18 Mark Mitchell * cp-tree.h (cp_tree_index): Add CPTI_FAKE_STD. diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h index ed25a8fc10e..54dbaa34da5 100644 --- a/gcc/cp/cp-tree.h +++ b/gcc/cp/cp-tree.h @@ -2481,7 +2481,7 @@ extern int flag_new_for_scope; /* Nonzero if NODE is a FUNCTION_DECL for a built-in function, and we have not yet seen a prototype for that function. */ #define DECL_ANTICIPATED(NODE) \ - (DECL_LANG_SPECIFIC (FUNCTION_DECL_CHECK (NODE))->decl_flags.anticipated_p) + (DECL_LANG_SPECIFIC (DECL_CHECK (NODE))->decl_flags.anticipated_p) /* Record whether a typedef for type `int' was actually `signed int'. */ #define C_TYPEDEF_EXPLICITLY_SIGNED(exp) DECL_LANG_FLAG_1 ((exp)) diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index ee4571c94e8..0dc17c13de2 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -5693,6 +5693,15 @@ select_decl (binding, flags) { tree val; val = BINDING_VALUE (binding); + + /* When we implicitly declare some builtin entity, we mark it + DECL_ANTICIPATED, so that we know to ignore it until it is + really declared. */ + if (val && DECL_P (val) + && DECL_LANG_SPECIFIC (val) + && DECL_ANTICIPATED (val)) + return NULL_TREE; + if (LOOKUP_NAMESPACES_ONLY (flags)) { /* We are not interested in types. */ diff --git a/gcc/testsuite/g++.old-deja/g++.other/std1.C b/gcc/testsuite/g++.old-deja/g++.other/std1.C new file mode 100644 index 00000000000..21a232a0879 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.other/std1.C @@ -0,0 +1,13 @@ +// Build don't link: +// Special g++ Options: -fhonor-std +// Origin: Mark Mitchell + +extern "C" int memcmp (const void * __s1, + const void * __s2, + __SIZE_TYPE__ __n) throw (); + +namespace std { +void f () { + memcmp (0, 0, 0); +} +}; -- 2.30.2