Extend -Wnon-pod-varargs to check calls made from member pointers.
llvm-svn: 184629
This commit is contained in:
parent
57d1c4865e
commit
9be9c6804f
|
@ -3798,7 +3798,8 @@ Sema::getVariadicCallType(FunctionDecl *FDecl, const FunctionProtoType *Proto,
|
|||
if (CXXMethodDecl *Method = dyn_cast_or_null<CXXMethodDecl>(FDecl))
|
||||
if (Method->isInstance())
|
||||
return VariadicMethod;
|
||||
}
|
||||
} else if (Fn && Fn->getType() == Context.BoundMemberTy)
|
||||
return VariadicMethod;
|
||||
return VariadicFunction;
|
||||
}
|
||||
return VariadicDoesNotApply;
|
||||
|
|
|
@ -10895,6 +10895,9 @@ Sema::BuildCallToMemberFunction(Scope *S, Expr *MemExprE,
|
|||
if (ConvertArgumentsForCall(call, op, 0, proto, Args, RParenLoc))
|
||||
return ExprError();
|
||||
|
||||
if (CheckOtherCall(call, proto))
|
||||
return ExprError();
|
||||
|
||||
return MaybeBindToTemporary(call);
|
||||
}
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ void t2()
|
|||
c.g(10, version);
|
||||
|
||||
void (C::*ptr)(int, ...) = &C::g;
|
||||
(c.*ptr)(10, c); // TODO: This should also warn.
|
||||
(c.*ptr)(10, c); // expected-warning{{cannot pass object of non-POD type 'C' through variadic method; call will abort at runtime}}
|
||||
(c.*ptr)(10, version);
|
||||
|
||||
C::h(10, c); // expected-warning{{cannot pass object of non-POD type 'C' through variadic function; call will abort at runtime}}
|
||||
|
@ -173,7 +173,7 @@ namespace t11 {
|
|||
(get_f_ptr())(10, c); // expected-warning{{cannot pass object of non-POD type 'C' through variadic function; call will abort at runtime}}
|
||||
(get_f_ptr())(10, version);
|
||||
|
||||
(c.*get_m_ptr())(10, c); // TODO: This should also warn.
|
||||
(c.*get_m_ptr())(10, c); // expected-warning{{cannot pass object of non-POD type 'C' through variadic method; call will abort at runtime}}
|
||||
(c.*get_m_ptr())(10, version);
|
||||
|
||||
(get_b_ptr())(10, c); // expected-warning{{cannot pass object of non-POD type 'C' through variadic block; call will abort at runtime}}
|
||||
|
@ -182,7 +182,7 @@ namespace t11 {
|
|||
(arr_f_ptr[3])(10, c); // expected-warning{{cannot pass object of non-POD type 'C' through variadic function; call will abort at runtime}}
|
||||
(arr_f_ptr[3])(10, version);
|
||||
|
||||
(c.*arr_m_ptr[3])(10, c); // TODO: This should also warn.
|
||||
(c.*arr_m_ptr[3])(10, c); // expected-warning{{cannot pass object of non-POD type 'C' through variadic method; call will abort at runtime}}
|
||||
(c.*arr_m_ptr[3])(10, version);
|
||||
|
||||
(arr_b_ptr[3])(10, c); // expected-warning{{cannot pass object of non-POD type 'C' through variadic block; call will abort at runtime}}
|
||||
|
|
Loading…
Reference in New Issue