]> granicus.if.org Git - clang/commitdiff
Change Expr::isLvalue() to allow the "void" type. This fixes bz2000 submitted by...
authorSteve Naroff <snaroff@apple.com>
Sun, 10 Feb 2008 00:30:18 +0000 (00:30 +0000)
committerSteve Naroff <snaroff@apple.com>
Sun, 10 Feb 2008 00:30:18 +0000 (00:30 +0000)
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46917 91177308-0d34-0410-b5e6-96231b3b80d8

AST/Expr.cpp
test/Sema/deref.c

index f02e817f0659dadc461ca9e2b5801b4a80177ef4..f979c7aa7b5e1cbefcf97d27c916d93637b10c7b 100644 (file)
@@ -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;
 
index 7441584107ce0fa1c933c4fa2b599be815138bee..7efb55e72059ee4aa449db79004fda9589685114 100644 (file)
@@ -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;
 }