Warn about typedefs of enums without any declarator name. Fixes rdar://problem/6503878
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62397 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp
index 7346526..82c8ea0 100644
--- a/lib/Sema/SemaDecl.cpp
+++ b/lib/Sema/SemaDecl.cpp
@@ -741,9 +741,9 @@
// Permit typedefs without declarators as a Microsoft extension.
if (!DS.isMissingDeclaratorOk()) {
- if (getLangOptions().Microsoft &&
- DS.getStorageClassSpec() == DeclSpec::SCS_typedef) {
- Diag(DS.getSourceRange().getBegin(), diag::ext_no_declarators)
+ if (DS.getStorageClassSpec() == DeclSpec::SCS_typedef &&
+ Tag && isa<EnumDecl>(Tag)) {
+ Diag(DS.getSourceRange().getBegin(), diag::warn_no_declarators)
<< DS.getSourceRange();
return Tag;
}