forked from OSchip/llvm-project
GCC compatibility: gcc allows applying va_args to const
va_lists for some reason. This fixes rdar://6726818 llvm-svn: 68434
This commit is contained in:
parent
b4d7102417
commit
9e658eccab
|
@ -4724,7 +4724,10 @@ Sema::OwningExprResult Sema::ActOnVAArg(SourceLocation BuiltinLoc,
|
|||
Expr *E = static_cast<Expr*>(expr.get());
|
||||
UsualUnaryConversions(E);
|
||||
|
||||
if (CheckAssignmentConstraints(VaListType, E->getType()) != Compatible)
|
||||
AssignConvertType ConvResult =
|
||||
CheckAssignmentConstraints(VaListType, E->getType());
|
||||
if (ConvResult != Compatible &&
|
||||
ConvResult != CompatiblePointerDiscardsQualifiers)
|
||||
return ExprError(Diag(E->getLocStart(),
|
||||
diag::err_first_argument_to_va_arg_not_of_type_va_list)
|
||||
<< E->getType() << E->getSourceRange());
|
||||
|
|
|
@ -60,3 +60,10 @@ void f7(int a, ...) {
|
|||
int *x = &__builtin_va_arg(ap, int); // expected-error {{address expression must be an lvalue or a function designator}}
|
||||
__builtin_va_end(ap);
|
||||
}
|
||||
|
||||
// rdar://6726818
|
||||
void f8() {
|
||||
const __builtin_va_list args2;
|
||||
(void)__builtin_va_arg(args2, int);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue