expression of deprecated type.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@115713
91177308-0d34-0410-b5e6-
96231b3b80d8
return QualType();
}
}
-
+ if (!E->isTypeDependent()) {
+ QualType T = E->getType();
+ if (const RecordType *EltTy = T->getAs<RecordType>())
+ DiagnoseUseOfDecl(EltTy->getDecl(), E->getExprLoc());
+ else if (const EnumType *Enum = T->getAs<EnumType>())
+ DiagnoseUseOfDecl(Enum->getDecl(), E->getExprLoc());
+ }
return Context.getTypeOfExprType(E);
}
--- /dev/null
+// RUN: %clang_cc1 %s -verify -fsyntax-only
+
+struct s { int a; } __attribute__((deprecated)) x; // expected-warning {{'s' is deprecated}}
+
+typeof(x) y; // expected-warning {{'s' is deprecated}}
+
+union un{ int a; } __attribute__((deprecated)) u; // expected-warning {{'un' is deprecated}}
+
+typeof( u) z; // expected-warning {{'un' is deprecated}}
+
+enum E{ one} __attribute__((deprecated)) e; // expected-warning {{'E' is deprecated}}
+
+typeof( e) w; // expected-warning {{'E' is deprecated}}