summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaExpr.cpp
diff options
context:
space:
mode:
authorEli Friedman <eli.friedman@gmail.com>2009-05-03 22:36:05 +0000
committerEli Friedman <eli.friedman@gmail.com>2009-05-03 22:36:05 +0000
commitb8c4fd8cfd27dbc63e1706729be4b330bf946a0c (patch)
tree49b37e6478c4351aec75ff84f6f8696af839cde3 /clang/lib/Sema/SemaExpr.cpp
parentba49fef34a7150c74f244e6fe134830d44587998 (diff)
downloadbcm5719-llvm-b8c4fd8cfd27dbc63e1706729be4b330bf946a0c.tar.gz
bcm5719-llvm-b8c4fd8cfd27dbc63e1706729be4b330bf946a0c.zip
PR2524: downgrade taking address of expression of type 'void' to an
extension warning. llvm-svn: 70805
Diffstat (limited to 'clang/lib/Sema/SemaExpr.cpp')
-rw-r--r--clang/lib/Sema/SemaExpr.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp
index 6ce98cd28f7..36ec9c65c13 100644
--- a/clang/lib/Sema/SemaExpr.cpp
+++ b/clang/lib/Sema/SemaExpr.cpp
@@ -4245,7 +4245,12 @@ QualType Sema::CheckAddressOfOperand(Expr *op, SourceLocation OpLoc) {
if (lval != Expr::LV_Valid) { // C99 6.5.3.2p1
// The operand must be either an l-value or a function designator
- if (!op->getType()->isFunctionType()) {
+ if (op->getType()->isFunctionType()) {
+ // Function designator is valid
+ } else if (lval == Expr::LV_IncompleteVoidType) {
+ Diag(OpLoc, diag::ext_typecheck_addrof_void)
+ << op->getSourceRange();
+ } else {
// FIXME: emit more specific diag...
Diag(OpLoc, diag::err_typecheck_invalid_lvalue_addrof)
<< op->getSourceRange();
OpenPOWER on IntegriCloud