diff options
author | Fariborz Jahanian <fjahanian@apple.com> | 2013-03-14 23:09:00 +0000 |
---|---|---|
committer | Fariborz Jahanian <fjahanian@apple.com> | 2013-03-14 23:09:00 +0000 |
commit | 96db329b3a982ac83c700c4469a3f618dc53cb42 (patch) | |
tree | 15f75569dcd53e02f6e499ec55ec02dd496ea6f4 /lib/Sema | |
parent | 57f8da506a0db208a936e26a8cb77267f638b26b (diff) |
Diagnose about extern "C" functions returning c++ objects
on first declaration only. // rdar://13364028
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@177127 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema')
-rw-r--r-- | lib/Sema/SemaDecl.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp index 4c6da45e5b..245bc2c0e7 100644 --- a/lib/Sema/SemaDecl.cpp +++ b/lib/Sema/SemaDecl.cpp @@ -6793,7 +6793,8 @@ bool Sema::CheckFunctionDeclaration(Scope *S, FunctionDecl *NewFD, // If this function is declared as being extern "C", then check to see if // the function returns a UDT (class, struct, or union type) that is not C // compatible, and if it does, warn the user. - if (NewFD->isExternC()) { + // But, issue any diagnostic on the first declaration only. + if (NewFD->isExternC() && Previous.empty()) { QualType R = NewFD->getResultType(); if (R->isIncompleteType() && !R->isVoidType()) Diag(NewFD->getLocation(), diag::warn_return_value_udt_incomplete) |