[cfe-commits] r68434 - in /cfe/trunk: lib/Sema/SemaExpr.cpp test/Sema/varargs.c
Chris Lattner
sabre at nondot.org
Sat Apr 4 17:53:00 PDT 2009
Author: lattner
Date: Sat Apr 4 19:52:59 2009
New Revision: 68434
URL: http://llvm.org/viewvc/llvm-project?rev=68434&view=rev
Log:
GCC compatibility: gcc allows applying va_args to const
va_lists for some reason. This fixes rdar://6726818
Modified:
cfe/trunk/lib/Sema/SemaExpr.cpp
cfe/trunk/test/Sema/varargs.c
Modified: cfe/trunk/lib/Sema/SemaExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExpr.cpp?rev=68434&r1=68433&r2=68434&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaExpr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExpr.cpp Sat Apr 4 19:52:59 2009
@@ -4724,7 +4724,10 @@
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());
Modified: cfe/trunk/test/Sema/varargs.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/varargs.c?rev=68434&r1=68433&r2=68434&view=diff
==============================================================================
--- cfe/trunk/test/Sema/varargs.c (original)
+++ cfe/trunk/test/Sema/varargs.c Sat Apr 4 19:52:59 2009
@@ -60,3 +60,10 @@
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);
+}
+
More information about the cfe-commits
mailing list