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());
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);
+}
+