diff options
-rw-r--r-- | clang/lib/Sema/SemaTemplateInstantiate.cpp | 3 | ||||
-rw-r--r-- | clang/test/SemaCXX/cxx0x-class.cpp | 8 |
2 files changed, 8 insertions, 3 deletions
diff --git a/clang/lib/Sema/SemaTemplateInstantiate.cpp b/clang/lib/Sema/SemaTemplateInstantiate.cpp index ba4a5b7bc0d..9f744a1dc1b 100644 --- a/clang/lib/Sema/SemaTemplateInstantiate.cpp +++ b/clang/lib/Sema/SemaTemplateInstantiate.cpp @@ -2264,9 +2264,6 @@ bool Sema::InstantiateInClassInitializer( if (auto *L = getASTMutationListener()) L->DefaultMemberInitializerInstantiated(Instantiation); - // Exit the scope of this instantiation. - SavedContext.pop(); - // Return true if the in-class initializer is still missing. return !Instantiation->getInClassInitializer(); } diff --git a/clang/test/SemaCXX/cxx0x-class.cpp b/clang/test/SemaCXX/cxx0x-class.cpp index 2b1338f97fd..8afb0fd6f3c 100644 --- a/clang/test/SemaCXX/cxx0x-class.cpp +++ b/clang/test/SemaCXX/cxx0x-class.cpp @@ -37,3 +37,11 @@ namespace Foo { int y = x; }; } + +// Instantiating another default member initializer while parsing one should +// not cause us to mess up the 'this' override. +template<typename> struct DefaultMemberTemplate { int n = 0; }; +class DefaultMemberInitSelf { + DefaultMemberTemplate<int> t = {}; + int *p = &t.n; +}; |