constructor's definition is in an implementation block.
Without this commit, ptr doesn't get initialized to null in the
following code:
struct S {
S();
void *ptr = nullptr;
};
@implementation I
S::S() {}
@end
rdar://problem/
25693624
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@266645
91177308-0d34-0410-b5e6-
96231b3b80d8
else {
if (Tok.is(tok::colon))
ParseConstructorInitializer(MCDecl);
+ else
+ Actions.ActOnDefaultCtorInitializers(MCDecl);
ParseFunctionStatementBody(MCDecl, BodyScope);
}
--- /dev/null
+// RUN: %clang_cc1 -triple x86_64-apple-macosx10.10 -std=c++11 -ast-dump %s | FileCheck %s
+// CHECK: CXXCtorInitializer Field {{.*}} 'ptr' 'void *'
+
+@interface NSObject
+@end
+
+@interface I : NSObject
+@end
+
+struct S {
+ S();
+ void *ptr = nullptr;
+};
+
+@implementation I
+S::S() {}
+@end