aboutsummaryrefslogtreecommitdiff
path: root/clang/lib
diff options
context:
space:
mode:
authorAaron Ballman <aaron@aaronballman.com>2022-08-09 11:35:37 -0400
committerTobias Hieta <tobias@hieta.se>2022-08-12 08:35:50 +0200
commit1fc6119ace14cd9baf00866f776cdd02d3af1308 (patch)
tree1c57afbc0df696f33a699b5421b50d5ca22eba8c /clang/lib
parentd945a2c9efda8f0a2d8a03cf48d5b5dc4076769d (diff)
downloadllvm-1fc6119ace14cd9baf00866f776cdd02d3af1308.zip
llvm-1fc6119ace14cd9baf00866f776cdd02d3af1308.tar.gz
llvm-1fc6119ace14cd9baf00866f776cdd02d3af1308.tar.bz2
Change prototype merging error into a warning for builtins
As was observed in https://reviews.llvm.org/D123627#3707635, it's confusing that a user can write: ``` float rintf(void) {} ``` and get a warning, but writing: ``` float rintf() {} ``` gives an error. This patch changes the behavior so that both are warnings, so that users who have functions which conflict with a builtin identifier can still use that identifier as they wish. Differential Revision: https://reviews.llvm.org/D131499 (cherry picked from commit 4c02ab8c9742f6c32b17f49a306b3b072486f5c5)
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/Sema/SemaDecl.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp
index 150168d..75ffa8b 100644
--- a/clang/lib/Sema/SemaDecl.cpp
+++ b/clang/lib/Sema/SemaDecl.cpp
@@ -4034,7 +4034,7 @@ bool Sema::MergeFunctionDecl(FunctionDecl *New, NamedDecl *&OldD, Scope *S,
// default argument promotion rules were already checked by
// ASTContext::typesAreCompatible().
if (Old->hasPrototype() && !New->hasWrittenPrototype() && NewDeclIsDefn &&
- Old->getNumParams() != New->getNumParams()) {
+ Old->getNumParams() != New->getNumParams() && !Old->isImplicit()) {
if (Old->hasInheritedPrototype())
Old = Old->getCanonicalDecl();
Diag(New->getLocation(), diag::err_conflicting_types) << New;