diff options
-rw-r--r-- | lib/Parse/ParseStmt.cpp | 4 | ||||
-rw-r--r-- | test/SemaCXX/member-init.cpp | 18 |
2 files changed, 21 insertions, 1 deletions
diff --git a/lib/Parse/ParseStmt.cpp b/lib/Parse/ParseStmt.cpp index e400ed1391..3abb0c5cbf 100644 --- a/lib/Parse/ParseStmt.cpp +++ b/lib/Parse/ParseStmt.cpp @@ -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(); diff --git a/test/SemaCXX/member-init.cpp b/test/SemaCXX/member-init.cpp index 7ca1f0e451..192851460c 100644 --- a/test/SemaCXX/member-init.cpp +++ b/test/SemaCXX/member-init.cpp @@ -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(...) { + } +} |