diff options
| author | Steve Naroff <snaroff@apple.com> | 2008-02-10 00:30:18 +0000 |
|---|---|---|
| committer | Steve Naroff <snaroff@apple.com> | 2008-02-10 00:30:18 +0000 |
| commit | 43c50866f13d054993466d001dca6b2201c8421e (patch) | |
| tree | 44bf244b70b61712864c87c76881c5a78942d269 | |
| parent | 52ea27db178dec1ba2a137ca8416a462419f385c (diff) | |
| download | bcm5719-llvm-43c50866f13d054993466d001dca6b2201c8421e.tar.gz bcm5719-llvm-43c50866f13d054993466d001dca6b2201c8421e.zip | |
Change Expr::isLvalue() to allow the "void" type. This fixes bz2000 submitted by Neil Booth.
Neil, can you point me to the place in the C99 spec that says this is allowed? I thought Expr::isLvalue() conformed to the spec, which says "C99 6.3.2.1: an lvalue is an expression with an object type or an incomplete type other than void.". Please advise.
llvm-svn: 46917
| -rw-r--r-- | clang/AST/Expr.cpp | 3 | ||||
| -rw-r--r-- | clang/test/Sema/deref.c | 8 |
2 files changed, 7 insertions, 4 deletions
diff --git a/clang/AST/Expr.cpp b/clang/AST/Expr.cpp index f02e817f065..f979c7aa7b5 100644 --- a/clang/AST/Expr.cpp +++ b/clang/AST/Expr.cpp @@ -357,9 +357,6 @@ Expr::isLvalueResult Expr::isLvalue() const { if (TR->isFunctionType()) // from isObjectType() return LV_NotObjectType; - if (TR->isVoidType()) - return LV_IncompleteVoidType; - if (TR->isReferenceType()) // C++ [expr] return LV_Valid; diff --git a/clang/test/Sema/deref.c b/clang/test/Sema/deref.c index 7441584107c..7efb55e7205 100644 --- a/clang/test/Sema/deref.c +++ b/clang/test/Sema/deref.c @@ -17,6 +17,12 @@ void foo2 (void) void foo3 (void) { void* x = 0; - void* y = &*x; // expected-error {{address expression must be an lvalue or a function designator}} + void* y = &*x; +} + +extern const void cv1; +const void *foo4 (void) +{ + return &cv1; } |

