forked from OSchip/llvm-project
In Microsoft mode, make "Unqualified lookup into dependent bases of class templates" works inside static functions.
llvm-svn: 144729
This commit is contained in:
parent
4c1b096743
commit
78286b24fd
|
@ -1534,7 +1534,7 @@ bool Sema::DiagnoseEmptyLookup(Scope *S, CXXScopeSpec &SS, LookupResult &R,
|
|||
CXXMethodDecl *DepMethod = cast_or_null<CXXMethodDecl>(
|
||||
CurMethod->getInstantiatedFromMemberFunction());
|
||||
if (DepMethod) {
|
||||
if (getLangOptions().MicrosoftExt)
|
||||
if (getLangOptions().MicrosoftMode)
|
||||
diagnostic = diag::warn_found_via_dependent_bases_lookup;
|
||||
Diag(R.getNameLoc(), diagnostic) << Name
|
||||
<< FixItHint::CreateInsertion(R.getNameLoc(), "this->");
|
||||
|
@ -1560,6 +1560,8 @@ bool Sema::DiagnoseEmptyLookup(Scope *S, CXXScopeSpec &SS, LookupResult &R,
|
|||
Diag(R.getNameLoc(), diagnostic) << Name;
|
||||
}
|
||||
} else {
|
||||
if (getLangOptions().MicrosoftMode)
|
||||
diagnostic = diag::warn_found_via_dependent_bases_lookup;
|
||||
Diag(R.getNameLoc(), diagnostic) << Name;
|
||||
}
|
||||
|
||||
|
|
|
@ -48,3 +48,26 @@ template class B<int>;
|
|||
|
||||
}
|
||||
|
||||
|
||||
|
||||
namespace lookup_dependent_base_class_static_function {
|
||||
|
||||
template <class T>
|
||||
class A {
|
||||
public:
|
||||
static void static_func();// expected-note {{must qualify identifier to find this declaration in dependent base class}}
|
||||
void func();// expected-note {{must qualify identifier to find this declaration in dependent base class}}
|
||||
};
|
||||
|
||||
|
||||
template <class T>
|
||||
class B : public A<T> {
|
||||
public:
|
||||
static void z2(){
|
||||
static_func(); // expected-warning {{use of identifier 'static_func' found via unqualified lookup into dependent bases of class templates is a Microsoft extension}}
|
||||
func(); // expected-warning {{use of identifier 'func' found via unqualified lookup into dependent bases of class templates is a Microsoft extension}} expected-error {{call to non-static member function without an object argument}}
|
||||
}
|
||||
};
|
||||
template class B<int>; // expected-note {{requested here}}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue