summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--clang/lib/Sema/SemaDecl.cpp2
-rw-r--r--clang/test/Sema/implicit-builtin-redecl.c7
2 files changed, 8 insertions, 1 deletions
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp
index a276f3c1cee..9cd5bc80694 100644
--- a/clang/lib/Sema/SemaDecl.cpp
+++ b/clang/lib/Sema/SemaDecl.cpp
@@ -660,7 +660,7 @@ bool Sema::MergeFunctionDecl(FunctionDecl *New, Decl *OldD) {
Diag(New->getLocation(), diag::warn_redecl_library_builtin) << New;
Diag(Old->getLocation(), diag::note_previous_builtin_declaration)
<< Old << Old->getType();
- return false;
+ return true;
}
PrevDiag = diag::note_previous_builtin_declaration;
diff --git a/clang/test/Sema/implicit-builtin-redecl.c b/clang/test/Sema/implicit-builtin-redecl.c
index 837f79f4ef6..9ff23f9f13b 100644
--- a/clang/test/Sema/implicit-builtin-redecl.c
+++ b/clang/test/Sema/implicit-builtin-redecl.c
@@ -5,3 +5,10 @@ static void* malloc(int);
static void* malloc(int size) {
return ((void*)0); /*do not use heap in this file*/
}
+
+void *calloc(int, int, int); // expected-warning{{incompatible redeclaration of library function 'calloc' will be ignored}} \
+// expected-note{{'calloc' is a builtin with type 'void *(unsigned long, unsigned long)'}}
+
+void f1(void) {
+ return calloc(0, 0, 0); // expected-error{{too many arguments to function call}}
+}
OpenPOWER on IntegriCloud