diff options
Diffstat (limited to 'clang')
| -rw-r--r-- | clang/lib/Sema/SemaDecl.cpp | 5 | ||||
| -rw-r--r-- | clang/test/CXX/class.access/p4.cpp | 12 | 
2 files changed, 15 insertions, 2 deletions
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp index d449951c980..9bdcf09b296 100644 --- a/clang/lib/Sema/SemaDecl.cpp +++ b/clang/lib/Sema/SemaDecl.cpp @@ -4336,8 +4336,6 @@ Sema::DeclPtrTy Sema::ActOnFinishFunctionBody(DeclPtrTy D, StmtArg BodyArg,      Body->Destroy(Context);      return DeclPtrTy();    } -  if (!IsInstantiation) -    PopDeclContext();    // Verify and clean out per-function state. @@ -4419,6 +4417,9 @@ Sema::DeclPtrTy Sema::ActOnFinishFunctionBody(DeclPtrTy D, StmtArg BodyArg,      assert(ExprTemporaries.empty() && "Leftover temporaries in function");    } +  if (!IsInstantiation) +    PopDeclContext(); +    PopFunctionOrBlockScope();    // If any errors have occurred, clear out any temporaries that may have diff --git a/clang/test/CXX/class.access/p4.cpp b/clang/test/CXX/class.access/p4.cpp index 0c87c07e064..07ecc6caf0a 100644 --- a/clang/test/CXX/class.access/p4.cpp +++ b/clang/test/CXX/class.access/p4.cpp @@ -283,3 +283,15 @@ namespace test10 {      };    };  } + +namespace test11 { +  class A { +    protected: virtual ~A(); +  }; + +  class B : public A { +    ~B(); +  }; + +  B::~B() {}; +}  | 

