diff options
author | Fariborz Jahanian <fjahanian@apple.com> | 2009-11-11 17:55:25 +0000 |
---|---|---|
committer | Fariborz Jahanian <fjahanian@apple.com> | 2009-11-11 17:55:25 +0000 |
commit | 03f62ed9bb386058126776589194d3bf8a72b19b (patch) | |
tree | d8ececf44bc8c884d16d8c6e27bfe3e06aa3ea42 /clang/lib/CodeGen | |
parent | 7a09964e81d1056068518da7f0be04e305058e2d (diff) | |
download | llvm-03f62ed9bb386058126776589194d3bf8a72b19b.zip llvm-03f62ed9bb386058126776589194d3bf8a72b19b.tar.gz llvm-03f62ed9bb386058126776589194d3bf8a72b19b.tar.bz2 |
Value initialize non-class array members in ctor's
initializer list. Fixes PR5463.
llvm-svn: 86849
Diffstat (limited to 'clang/lib/CodeGen')
-rw-r--r-- | clang/lib/CodeGen/CGCXX.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/clang/lib/CodeGen/CGCXX.cpp b/clang/lib/CodeGen/CGCXX.cpp index 40e90ee..3e9951f 100644 --- a/clang/lib/CodeGen/CGCXX.cpp +++ b/clang/lib/CodeGen/CGCXX.cpp @@ -1511,7 +1511,14 @@ static void EmitMemberInitializer(CodeGenFunction &CGF, RHS = RValue::get(CGF.CGM.EmitConstantExpr(RhsExpr, FieldType, &CGF)); else RHS = RValue::get(CGF.EmitScalarExpr(RhsExpr, true)); - CGF.EmitStoreThroughLValue(RHS, LHS, FieldType); + if (Array && !FieldType->getAs<RecordType>()) { + // value initialize a non-class array data member using arr() syntax in + // initializer list. + QualType Ty = CGF.getContext().getCanonicalType((Field)->getType()); + CGF.EmitMemSetToZero(LHS.getAddress(), Ty); + } + else + CGF.EmitStoreThroughLValue(RHS, LHS, FieldType); } /// EmitCtorPrologue - This routine generates necessary code to initialize |