C11 allows typedefs to be redefined. Implement this in C11 mode, and
downgrade the default-error warning to an ExtWarn in
C90/99. <rdar://problem/10668057>
llvm-svn: 147925
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp
index a2bf48e..588fc14 100644
--- a/clang/lib/Sema/SemaDecl.cpp
+++ b/clang/lib/Sema/SemaDecl.cpp
@@ -1463,8 +1463,6 @@
// The types match. Link up the redeclaration chain if the old
// declaration was a typedef.
- // FIXME: this is a potential source of weirdness if the type
- // spellings don't match exactly.
if (TypedefNameDecl *Typedef = dyn_cast<TypedefNameDecl>(Old))
New->setPreviousDeclaration(Typedef);
@@ -1509,8 +1507,8 @@
return New->setInvalidDecl();
}
- // Modules always permit redefinition of typedefs.
- if (getLangOptions().Modules)
+ // Modules always permit redefinition of typedefs, as does C11.
+ if (getLangOptions().Modules || getLangOptions().C11)
return;
// If we have a redefinition of a typedef in C, emit a warning. This warning