Refine bug fix to Expr::isLvalue (commit r46917).

llvm-svn: 46919
This commit is contained in:
Steve Naroff 2008-02-10 01:39:04 +00:00
parent 0ededbc68e
commit 1018ea35b7
2 changed files with 10 additions and 1 deletions

View 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;

View 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}}
}