]> granicus.if.org Git - clang/commitdiff
Refine bug fix to Expr::isLvalue (commit r46917).
authorSteve Naroff <snaroff@apple.com>
Sun, 10 Feb 2008 01:39:04 +0000 (01:39 +0000)
committerSteve Naroff <snaroff@apple.com>
Sun, 10 Feb 2008 01:39:04 +0000 (01:39 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46919 91177308-0d34-0410-b5e6-96231b3b80d8

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

index f979c7aa7b5e1cbefcf97d27c916d93637b10c7b..00ff897ffb13b82d3161c1c9193ec7f5d8a4ca4a 100644 (file)
@@ -357,6 +357,10 @@ Expr::isLvalueResult Expr::isLvalue() const {
   if (TR->isFunctionType()) // from isObjectType()
     return LV_NotObjectType;
 
+  // Allow qualified void which is an incomplete type other than void (yuck).
+  if (TR->isVoidType() && !TR.getQualifiers())
+    return LV_IncompleteVoidType;
+
   if (TR->isReferenceType()) // C++ [expr]
     return LV_Valid;
 
index 7efb55e72059ee4aa449db79004fda9589685114..8f8156d81f70c7be223cf5a8bc382c0cbfa47834 100644 (file)
@@ -17,7 +17,7 @@ void foo2 (void)
 void foo3 (void)
 {
  void* x = 0;
- void* y = &*x;
+ void* y = &*x; // expected-error{{address expression must be an lvalue or a function designator}}
 }
 
 extern const void cv1;
@@ -26,3 +26,8 @@ const void *foo4 (void)
   return &cv1;
 }
 
+extern void cv2;
+void *foo5 (void)
+{
+  return &cv2; // expected-error{{address expression must be an lvalue or a function designator}}
+}