[PATCH] Only use MSVC-compatible dependent base class hack for class template members.
Kim Gräsman
kim.grasman at gmail.com
Wed Aug 13 13:30:01 PDT 2014
Thanks! Could you try this one instead? I think it's more representative of what we should do, i.e. only fall back if we're in a CXXRecordDecl and said record has dependent bases.
http://reviews.llvm.org/D4854
Files:
lib/Sema/SemaCXXScopeSpec.cpp
test/SemaTemplate/ms-lookup-template-base-classes.cpp
Index: lib/Sema/SemaCXXScopeSpec.cpp
===================================================================
--- lib/Sema/SemaCXXScopeSpec.cpp
+++ lib/Sema/SemaCXXScopeSpec.cpp
@@ -703,8 +703,11 @@
if (getLangOpts().MSVCCompat) {
DeclContext *DC = LookupCtx ? LookupCtx : CurContext;
if (DC->isDependentContext() && DC->isFunctionOrMethod()) {
- SS.Extend(Context, &Identifier, IdentifierLoc, CCLoc);
- return false;
+ CXXRecordDecl *ContainingClass = dyn_cast<CXXRecordDecl>(DC->getParent());
+ if (ContainingClass && ContainingClass->hasAnyDependentBases()) {
+ SS.Extend(Context, &Identifier, IdentifierLoc, CCLoc);
+ return false;
+ }
}
}
Index: test/SemaTemplate/ms-lookup-template-base-classes.cpp
===================================================================
--- test/SemaTemplate/ms-lookup-template-base-classes.cpp
+++ test/SemaTemplate/ms-lookup-template-base-classes.cpp
@@ -460,3 +460,11 @@
int x = f<NameFromBase>();
};
}
+
+namespace function_template_undef_impl {
+template<class T>
+void f() {
+ Undef::staticMethod(); // expected-error {{use of undeclared identifier 'Undef'}}
+ UndefVar.method(); // expected-error {{use of undeclared identifier 'UndefVar'}}
+}
+}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D4854.12469.patch
Type: text/x-patch
Size: 1254 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20140813/89df4e1a/attachment.bin>
More information about the cfe-commits
mailing list