First pass at implementing the intent of ANSI C DR106.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120904 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp
index cf17566..3d6d59a 100644
--- a/lib/Sema/SemaExpr.cpp
+++ b/lib/Sema/SemaExpr.cpp
@@ -269,6 +269,13 @@
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/lib/Sema/SemaExprCXX.cpp b/lib/Sema/SemaExprCXX.cpp
index fc396b9..eec2fc8 100644
--- a/lib/Sema/SemaExprCXX.cpp
+++ b/lib/Sema/SemaExprCXX.cpp
@@ -3549,8 +3549,9 @@
}
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) {