When parsing a function-try-block that does not have a

ctor-initializer, remember to call the Sema action to generate default
ctor-initializers. What a delightful little miscompile. Fixes PR10578
/ <rdar://problem/9877267>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139253 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Douglas Gregor 2011-09-07 20:36:12 +00:00
Родитель 82340e8cbd
Коммит 2eef427c86
2 изменённых файлов: 21 добавлений и 1 удалений

Просмотреть файл

@ -1856,7 +1856,9 @@ Decl *Parser::ParseFunctionTryBlock(Decl *Decl, ParseScope &BodyScope) {
// Constructor initializer list?
if (Tok.is(tok::colon))
ParseConstructorInitializer(Decl);
else
Actions.ActOnDefaultCtorInitializers(Decl);
if (PP.isCodeCompletionEnabled()) {
if (trySkippingFunctionBodyForCodeCompletion()) {
BodyScope.Exit();

Просмотреть файл

@ -52,3 +52,21 @@ struct CheckExcSpecFail {
struct TypedefInit {
typedef int A = 0; // expected-error {{illegal initializer}}
};
// PR10578 / <rdar://problem/9877267>
namespace PR10578 {
template<typename T>
struct X {
X() {
T* x = 1; // expected-error{{cannot initialize a variable of type 'int *' with an rvalue of type 'int'}}
}
};
struct Y : X<int> {
Y();
};
Y::Y() try { // expected-note{{in instantiation of member function 'PR10578::X<int>::X' requested here}}
} catch(...) {
}
}