* name-lookup.c (do_nonmember_using_decl): A real function
declaration takes precedence over an anticipated declaration.
* g++.dg/ext/builtin1.C: New
* g++.dg/ext/builtin2.C: New
* g++.dg/ext/builtin3.C: New
* g++.dg/ext/builtin4.C: New
* g++.dg/ext/builtin5.C: New
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@91972
138bc75d-0d04-0410-961f-
82ee72b054a4
+2004-12-09 Matt Austern <austern@apple.com>
+
+ PR c++/18514
+ * name-lookup.c (do_nonmember_using_decl): A real function
+ declaration takes precedence over an anticipated declaration.
+
2004-12-09 Volker Reichelt <reichelt@igpm.rwth-aachen.de>
* parser.c (cp_parser_member_declaration): Fix comment typo.
are the same extern "C" functions, that's ok. */
if (decls_match (new_fn, old_fn))
{
- /* If the OLD_FN was a builtin, there is now a
- real declaration. */
+ /* If the OLD_FN was a builtin, we've seen a real
+ declaration in another namespace. Use it instead.
+ Set tmp1 to NULL so we can use the existing
+ OVERLOAD logic at the end of this inner loop.
+ */
if (DECL_ANTICIPATED (old_fn))
- DECL_ANTICIPATED (old_fn) = 0;
+ {
+ gcc_assert (! DECL_ANTICIPATED (new_fn));
+ tmp1 = NULL;
+ }
break;
}
else if (!DECL_ANTICIPATED (old_fn))
+2004-12-09 Matt Austern <austern@apple.com>
+
+ PR c++/18514
+ * g++.dg/ext/builtin1.C: New
+ * g++.dg/ext/builtin2.C: New
+ * g++.dg/ext/builtin3.C: New
+ * g++.dg/ext/builtin4.C: New
+ * g++.dg/ext/builtin5.C: New
+
2004-12-09 Andrew Pinski <pinskia@physics.uc.edu>
PR tree-opt/18904
--- /dev/null
+// Test whether alternate 'asm' name is applied correctly to
+// builtin in global namespace
+
+// { dg-do compile }
+// { dg-options "" }
+// { dg-final { scan-assembler "fancy_printf" } }
+
+extern "C" int printf(char*, ...) __asm("_fancy_printf");
+
+void foo() { printf("abc"); }
--- /dev/null
+// PR c++/18514
+// Test whether alternate 'asm' name is applied correctly to
+// builtin imported into namespace std.
+
+// { dg-do compile }
+// { dg-options "" }
+// { dg-final { scan-assembler "fancy_printf" } }
+
+extern "C" int printf(char*, ...) __asm("_fancy_printf");
+
+namespace std { using ::printf; }
+
+namespace std { void foo() { printf("abc"); } }
--- /dev/null
+// Verify that declaring builtin in namespace std doesn't give us
+// declaration in global namespace
+
+// { dg-do compile }
+// { dg-options "" }
+
+namespace std {
+extern "C" int printf(char*, ...);
+}
+
+void foo() {
+ printf("abc"); // { dg-error "not declared" }
+}
--- /dev/null
+// Verify that builtin is used when declared in global namespace
+
+// { dg-do compile }
+// { dg-options "-Wall" }
+
+extern "C" int printf(const char*,...);
+
+void foo() {
+ printf("%d"); // { dg-warning "too few arguments" }
+}
--- /dev/null
+// Verify that builtin is used when declared in namespace std
+
+// { dg-do compile }
+// { dg-options "-Wall" }
+
+namespace std {
+ extern "C" int printf(const char*,...);
+}
+
+void foo() {
+ std::printf("%d"); // { dg-warning "too few arguments" }
+}