diff options
| author | Douglas Gregor <dgregor@apple.com> | 2011-10-09 19:10:41 +0000 |
|---|---|---|
| committer | Douglas Gregor <dgregor@apple.com> | 2011-10-09 19:10:41 +0000 |
| commit | 668d3625030b37a340af05da9c8da0d79179698c (patch) | |
| tree | 053ea6e31ce1504a2cd1e36178ce042ee887147f /clang/lib/Sema/SemaExpr.cpp | |
| parent | bb64afcc39cd0a865610306a8989332ab6e67c4a (diff) | |
| download | bcm5719-llvm-668d3625030b37a340af05da9c8da0d79179698c.tar.gz bcm5719-llvm-668d3625030b37a340af05da9c8da0d79179698c.zip | |
Only allow taking the address of an expression of type 'overloaded
function type' when that expression is actually an overloaded function
reference (and not the address of an overloaded function
reference). Fixes PR11066.
llvm-svn: 141514
Diffstat (limited to 'clang/lib/Sema/SemaExpr.cpp')
| -rw-r--r-- | clang/lib/Sema/SemaExpr.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp index de35ec85252..ee985f4ba73 100644 --- a/clang/lib/Sema/SemaExpr.cpp +++ b/clang/lib/Sema/SemaExpr.cpp @@ -7348,8 +7348,15 @@ static QualType CheckAddressOfOperand(Sema &S, Expr *OrigOp, SourceLocation OpLoc) { if (OrigOp->isTypeDependent()) return S.Context.DependentTy; - if (OrigOp->getType() == S.Context.OverloadTy) + if (OrigOp->getType() == S.Context.OverloadTy) { + if (!isa<OverloadExpr>(OrigOp->IgnoreParens())) { + S.Diag(OpLoc, diag::err_typecheck_invalid_lvalue_addrof) + << OrigOp->getSourceRange(); + return QualType(); + } + return S.Context.OverloadTy; + } if (OrigOp->getType() == S.Context.UnknownAnyTy) return S.Context.UnknownAnyTy; if (OrigOp->getType() == S.Context.BoundMemberTy) { |

