summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaTemplate.cpp
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2015-07-06 01:45:27 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2015-07-06 01:45:27 +0000
commit88fe69ce210ecbec9f4850aed2c56074ef310437 (patch)
treee4856ac18a5b883c9b935d133bda1ec4286d9b95 /clang/lib/Sema/SemaTemplate.cpp
parenta60a6db73f36f72ed7ad1474b713630d938c42eb (diff)
downloadbcm5719-llvm-88fe69ce210ecbec9f4850aed2c56074ef310437.tar.gz
bcm5719-llvm-88fe69ce210ecbec9f4850aed2c56074ef310437.zip
DR1909: Diagnose all invalid cases of a class member sharing its name with the class.
llvm-svn: 241425
Diffstat (limited to 'clang/lib/Sema/SemaTemplate.cpp')
-rw-r--r--clang/lib/Sema/SemaTemplate.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/clang/lib/Sema/SemaTemplate.cpp b/clang/lib/Sema/SemaTemplate.cpp
index f4740a5cd85..79df1f210e6 100644
--- a/clang/lib/Sema/SemaTemplate.cpp
+++ b/clang/lib/Sema/SemaTemplate.cpp
@@ -893,6 +893,16 @@ Sema::CheckClassTemplate(Scope *S, unsigned TagSpec, TagUseKind TUK,
LookupQualifiedName(Previous, SemanticContext);
} else {
SemanticContext = CurContext;
+
+ // C++14 [class.mem]p14:
+ // If T is the name of a class, then each of the following shall have a
+ // name different from T:
+ // -- every member template of class T
+ if (TUK != TUK_Friend &&
+ DiagnoseClassNameShadow(SemanticContext,
+ DeclarationNameInfo(Name, NameLoc)))
+ return true;
+
LookupName(Previous, S);
}
OpenPOWER on IntegriCloud