aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexandre Oliva <aoliva@redhat.com>2005-04-22 16:57:23 +0000
committerAlexandre Oliva <aoliva@gcc.gnu.org>2005-04-22 16:57:23 +0000
commit1a32490a09a190b47b7c9c8386407505f554dd16 (patch)
tree1bc4cc982a0d35c0669178d387acfbefa38e5fa8
parent1751a45f796f13558050ff5c10bd2a6e97cb20f6 (diff)
downloadgcc-1a32490a09a190b47b7c9c8386407505f554dd16.zip
gcc-1a32490a09a190b47b7c9c8386407505f554dd16.tar.gz
gcc-1a32490a09a190b47b7c9c8386407505f554dd16.tar.bz2
re PR c++/21087 (ICE in do_nonmember_using_decl)
gcc/cp/ChangeLog: PR c++/21087 * name-lookup.c (push_overloaded_decl): Do not overload with non-duplicate anticipated built-in. gcc/testsuite/ChangeLog: PR c++/21087 * g++.dg/lookup/builtin2.C: New test. From-SVN: r98570
-rw-r--r--gcc/cp/ChangeLog6
-rw-r--r--gcc/cp/name-lookup.c7
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/g++.dg/lookup/builtin2.C19
4 files changed, 37 insertions, 0 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index bc8cb03..30eb866 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,9 @@
+2005-04-22 Alexandre Oliva <aoliva@redhat.com>
+
+ PR c++/21087
+ * name-lookup.c (push_overloaded_decl): Do not overload with
+ non-duplicate anticipated built-in.
+
2005-04-21 Kazu Hirata <kazu@cs.umass.edu>
* cp-tree.h (THROW_NAME, AUTO_VTABLE_NAME, AUTO_TEMP_FORMAT,
diff --git a/gcc/cp/name-lookup.c b/gcc/cp/name-lookup.c
index d2cf1ce..ce1d5b3 100644
--- a/gcc/cp/name-lookup.c
+++ b/gcc/cp/name-lookup.c
@@ -1883,6 +1883,13 @@ push_overloaded_decl (tree decl, int flags)
if (duplicate_decls (decl, fn) == fn)
POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, fn);
}
+
+ /* We don't overload implicit built-ins. duplicate_decls()
+ may fail to merge the decls if the new decl is e.g. a
+ template function. */
+ if (TREE_CODE (old) == FUNCTION_DECL
+ && DECL_ANTICIPATED (old))
+ old = NULL;
}
else if (old == error_mark_node)
/* Ignore the undefined symbol marker. */
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index c55ee24..6b36764 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2005-04-22 Alexandre Oliva <aoliva@redhat.com>
+
+ PR c++/21087
+ * g++.dg/lookup/builtin2.C: New test.
+
2005-04-22 Joseph S. Myers <joseph@codesourcery.com>
* gcc.dg/weak/weak-13.c: New test.
diff --git a/gcc/testsuite/g++.dg/lookup/builtin2.C b/gcc/testsuite/g++.dg/lookup/builtin2.C
new file mode 100644
index 0000000..be0a6f6
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lookup/builtin2.C
@@ -0,0 +1,19 @@
+/* { dg-do compile } */
+
+/* PR c++/21087 */
+
+/* We used to overload the template function with the built-in
+ declaration, instead of replacing it as we should, and then barf at
+ the using decl because of a test that none of the overload set
+ members were anticipated built-ins. */
+
+extern "C" signed int toupper(signed int __c) throw();
+namespace std
+{
+ template< typename a > a toupper(a,int){}
+ using ::toupper;
+}
+
+int f () {
+ std::toupper((signed int)'a');
+}