with type conversion to fix ir-gen crash.
llvm-svn: 77000
def err_mem_init_not_member_or_class : Error<
"member initializer %0 does not name a non-static data member or base "
"class">;
+def err_mem_initializer_mismatch : Error<
+ "Too many arguments for member initializer %0">;
def warn_field_initialized : Warning<
"member '%0' will be initialized after">,
C = PerformInitializationByConstructor(
FieldType, (Expr **)Args, NumArgs, IdLoc,
SourceRange(IdLoc, RParenLoc), Member->getDeclName(), IK_Direct);
+ else if (NumArgs != 1)
+ return Diag(IdLoc, diag::err_mem_initializer_mismatch)
+ << MemberOrBase << SourceRange(IdLoc, RParenLoc);
+ else {
+ Expr * NewExp = (Expr*)Args[0];
+ if (PerformCopyInitialization(NewExp, FieldType, "passing"))
+ return true;
+ Args[0] = NewExp;
+ }
// FIXME: Perform direct initialization of the member.
return new (Context) CXXBaseOrMemberInitializer(Member, (Expr **)Args,
NumArgs, C, IdLoc);
};
// FIXME. This is bad message!
-struct M { // expected-note {{candidate function}} \
- // expected-note {{candidate function}}
+struct M {
M(int i, int j); // expected-note {{candidate function}} \
// // expected-note {{candidate function}}
};
M m; // expected-error {{default constructor for 'struct M' is missing in initialization of mamber}}
};
+struct Q {
+ Q() : f1(1,2), // expected-error {{Too many arguments for member initializer 'f1'}}
+ pf(0.0) { } // expected-error {{incompatible type passing 'double', expected 'float *'}}
+ float f1;
+
+ float *pf;
+};