forked from OSchip/llvm-project
improve decl merging logic to be more correct with
functions. Patch contributed by Nuno Lopes, thanks! llvm-svn: 43757
This commit is contained in:
parent
0fc613b85d
commit
45d561ad99
|
@ -246,6 +246,11 @@ FunctionDecl *Sema::MergeFunctionDecl(FunctionDecl *New, ScopedDecl *OldD) {
|
|||
return New;
|
||||
}
|
||||
|
||||
if (New->getBody() == 0 &&
|
||||
Old->getCanonicalType() == New->getCanonicalType()) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
// TODO: CHECK FOR CONFLICTS, multiple decls with same name in one scope.
|
||||
// TODO: This is totally simplistic. It should handle merging functions
|
||||
// together etc, merging extern int X; int X; ...
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
// RUN: clang %s -verify -fsyntax-only
|
||||
|
||||
void foo(void);
|
||||
void foo(void) {} // expected-error{{previous definition is here}}
|
||||
void foo(void);
|
||||
void foo(void);
|
||||
|
||||
void foo(int); // expected-error {{redefinition of 'foo'}}
|
Loading…
Reference in New Issue