Daniel convinced me that accepting "const va_list" arguments to va_arg is
a really really bad idea. Now that we emit an error about the unpromoted
type, users should be able to understand what is going on.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68447 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp
index 99afd32..602f7fc 100644
--- a/lib/Sema/SemaExpr.cpp
+++ b/lib/Sema/SemaExpr.cpp
@@ -4725,16 +4725,7 @@
// Make sure the input expression also decays appropriately.
UsualUnaryConversions(E);
- AssignConvertType ConvResult =
- CheckAssignmentConstraints(VaListType, E->getType());
- switch (ConvResult) {
- case Compatible: break; // Everything good.
- case CompatiblePointerDiscardsQualifiers:
- Diag(E->getLocStart(), diag::warn_va_arg_with_qualified_va_list)
- << OrigExpr->getType() << E->getSourceRange();
- break;
-
- default:
+ if (CheckAssignmentConstraints(VaListType, E->getType()) != Compatible) {
return ExprError(Diag(E->getLocStart(),
diag::err_first_argument_to_va_arg_not_of_type_va_list)
<< OrigExpr->getType() << E->getSourceRange());