diff options
Diffstat (limited to 'clang')
| -rw-r--r-- | clang/lib/Sema/SemaExpr.cpp | 10 | ||||
| -rw-r--r-- | clang/test/SemaCXX/MicrosoftCompatibility.cpp | 22 | 
2 files changed, 32 insertions, 0 deletions
diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp index 31eb19e1747..c06f5a7b83b 100644 --- a/clang/lib/Sema/SemaExpr.cpp +++ b/clang/lib/Sema/SemaExpr.cpp @@ -1690,6 +1690,16 @@ ExprResult Sema::ActOnIdExpression(Scope *S,      // If this name wasn't predeclared and if this is not a function      // call, diagnose the problem.      if (R.empty()) { + +      // In Microsoft mode, if we are inside a template class member function +      // and we can't resolve an identifier then assume the identifier is type +      // dependent. The goal is to postpone name lookup to instantiation time  +      // to be able to search into type dependent base classes. +      if (getLangOptions().MicrosoftMode && CurContext->isDependentContext() && +          isa<CXXMethodDecl>(CurContext)) +        return ActOnDependentIdExpression(SS, NameInfo, IsAddressOfOperand, +                                          TemplateArgs); +        if (DiagnoseEmptyLookup(S, SS, R, CTC_Unknown))          return ExprError(); diff --git a/clang/test/SemaCXX/MicrosoftCompatibility.cpp b/clang/test/SemaCXX/MicrosoftCompatibility.cpp index 788fcfbff02..1370b7dbf4f 100644 --- a/clang/test/SemaCXX/MicrosoftCompatibility.cpp +++ b/clang/test/SemaCXX/MicrosoftCompatibility.cpp @@ -134,3 +134,25 @@ void function_missing_typename()  template void function_missing_typename<D>();
  }
 +
 +
 +
 +namespace lookup_dependent_bases_id_expr {
 +
 +template<class T> class A {
 +public:
 +  int var;
 +};
 +
 +
 +template<class T>
 +class B : public A<T> {
 +public:
 +  void f() {
 +    var = 3;
 +  }
 +};
 +
 +template class B<int>;
 +
 +}
\ No newline at end of file  | 

