Don't do an expensive definition check where a cheap 'is this C?' check suffices.

llvm-svn: 95188
This commit is contained in:
Sebastian Redl 2010-02-03 02:08:48 +00:00
parent 0b78cc2af5
commit d85be0cc60
1 changed files with 2 additions and 1 deletions

View File

@ -1300,7 +1300,8 @@ void Sema::MergeVarDecl(VarDecl *New, LookupResult &Previous) {
// C++ doesn't have tentative definitions, so go right ahead and check here.
const VarDecl *Def;
if (New->isThisDeclarationADefinition() == VarDecl::Definition &&
if (getLangOptions().CPlusPlus &&
New->isThisDeclarationADefinition() == VarDecl::Definition &&
(Def = Old->getDefinition())) {
Diag(New->getLocation(), diag::err_redefinition)
<< New->getDeclName();