diff options
| author | John McCall <rjmccall@apple.com> | 2010-12-04 12:29:11 +0000 |
|---|---|---|
| committer | John McCall <rjmccall@apple.com> | 2010-12-04 12:29:11 +0000 |
| commit | ca61b6567bab5b1d3e7210969d55e15d1177f5de (patch) | |
| tree | 0baeb323e2cb7760159b8f7b1886020f1d5c3465 /clang/lib/Sema | |
| parent | a03eddad588659043cabca7b591a3e14c76c8875 (diff) | |
| download | bcm5719-llvm-ca61b6567bab5b1d3e7210969d55e15d1177f5de.tar.gz bcm5719-llvm-ca61b6567bab5b1d3e7210969d55e15d1177f5de.zip | |
First pass at implementing the intent of ANSI C DR106.
llvm-svn: 120904
Diffstat (limited to 'clang/lib/Sema')
| -rw-r--r-- | clang/lib/Sema/SemaExpr.cpp | 7 | ||||
| -rw-r--r-- | clang/lib/Sema/SemaExprCXX.cpp | 5 |
2 files changed, 10 insertions, 2 deletions
diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp index cf17566d41a..3d6d59a406a 100644 --- a/clang/lib/Sema/SemaExpr.cpp +++ b/clang/lib/Sema/SemaExpr.cpp @@ -269,6 +269,13 @@ void Sema::DefaultFunctionArrayLvalueConversion(Expr *&E) { T->isRecordType())) return; + // The C standard is actually really unclear on this point, and + // DR106 tells us what the result should be but not why. It's + // generally best to say that void just doesn't undergo + // lvalue-to-rvalue at all. + if (T->isVoidType()) + return; + // C++ [conv.lval]p1: // [...] If T is a non-class type, the type of the prvalue is the // cv-unqualified version of T. Otherwise, the type of the diff --git a/clang/lib/Sema/SemaExprCXX.cpp b/clang/lib/Sema/SemaExprCXX.cpp index fc396b992f4..eec2fc88db6 100644 --- a/clang/lib/Sema/SemaExprCXX.cpp +++ b/clang/lib/Sema/SemaExprCXX.cpp @@ -3549,8 +3549,9 @@ void Sema::IgnoredValueConversions(Expr *&E) { } DefaultFunctionArrayLvalueConversion(E); - RequireCompleteType(E->getExprLoc(), E->getType(), - diag::err_incomplete_type); + if (!E->getType()->isVoidType()) + RequireCompleteType(E->getExprLoc(), E->getType(), + diag::err_incomplete_type); } ExprResult Sema::ActOnFinishFullExpr(Expr *FullExpr) { |

