Follow-up to r299363 "Enhance -Wshadow to warn when shadowing typedefs or type
aliases".
Patch by Ahmed Asadi.
Differential Revision: https://reviews.llvm.org/D31235
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@299522
91177308-0d34-0410-b5e6-
96231b3b80d8
/// if it doesn't shadow any declaration or shadowing warnings are disabled.
NamedDecl *Sema::getShadowedDeclaration(const TypedefNameDecl *D,
const LookupResult &R) {
+ // Don't warn if typedef declaration is part of a class
+ if (D->getDeclContext()->isRecord())
+ return nullptr;
+
if (!shouldWarnIfShadowedDecl(Diags, R))
return nullptr;
}
};
+struct path {
+ using value_type = char;
+ typedef char value_type2;
+ struct iterator {
+ using value_type = path; // no warning
+ typedef path value_type2; // no warning
+ };
+};
+
+
// TODO: this should warn, <rdar://problem/5018057>
class B : A {
int data;