Skip to content
This repository was archived by the owner on Mar 28, 2020. It is now read-only.

Commit 2bc6921

Browse files
committed
Fix rejects-valid with default member initializers exposed by r291318.
Don't prematurely clean up an RAII object; there's another RAII object in the same scope that tries to save and restore the same member! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@291551 91177308-0d34-0410-b5e6-96231b3b80d8
1 parent 84bfee6 commit 2bc6921

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

lib/Sema/SemaTemplateInstantiate.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2264,9 +2264,6 @@ bool Sema::InstantiateInClassInitializer(
22642264
if (auto *L = getASTMutationListener())
22652265
L->DefaultMemberInitializerInstantiated(Instantiation);
22662266

2267-
// Exit the scope of this instantiation.
2268-
SavedContext.pop();
2269-
22702267
// Return true if the in-class initializer is still missing.
22712268
return !Instantiation->getInClassInitializer();
22722269
}

test/SemaCXX/cxx0x-class.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,11 @@ namespace Foo {
3737
int y = x;
3838
};
3939
}
40+
41+
// Instantiating another default member initializer while parsing one should
42+
// not cause us to mess up the 'this' override.
43+
template<typename> struct DefaultMemberTemplate { int n = 0; };
44+
class DefaultMemberInitSelf {
45+
DefaultMemberTemplate<int> t = {};
46+
int *p = &t.n;
47+
};

0 commit comments

Comments
 (0)