diff options
author | Fariborz Jahanian <fjahanian@apple.com> | 2010-08-24 22:21:48 +0000 |
---|---|---|
committer | Fariborz Jahanian <fjahanian@apple.com> | 2010-08-24 22:21:48 +0000 |
commit | e0fd5a9299d96568023d0685e1232cc8c03b325f (patch) | |
tree | d8710460d7f119777fe2dea07e7b78ae3676b267 /clang/lib | |
parent | ec00a268552c93b79c5049111b674e2aa184bf5d (diff) | |
download | bcm5719-llvm-e0fd5a9299d96568023d0685e1232cc8c03b325f.tar.gz bcm5719-llvm-e0fd5a9299d96568023d0685e1232cc8c03b325f.zip |
It is not error in c++ to take address of
register variable (c++03 7.1.1P3). radar 8108252.
llvm-svn: 111977
Diffstat (limited to 'clang/lib')
-rw-r--r-- | clang/lib/Sema/SemaExpr.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp index bd76b9ff129..6acef58f2c2 100644 --- a/clang/lib/Sema/SemaExpr.cpp +++ b/clang/lib/Sema/SemaExpr.cpp @@ -6278,7 +6278,10 @@ QualType Sema::CheckAddressOfOperand(Expr *op, SourceLocation OpLoc) { // We have an lvalue with a decl. Make sure the decl is not declared // with the register storage-class specifier. if (const VarDecl *vd = dyn_cast<VarDecl>(dcl)) { - if (vd->getStorageClass() == VarDecl::Register) { + // in C++ it is not error to take address of a register + // variable (c++03 7.1.1P3) + if (vd->getStorageClass() == VarDecl::Register && + !getLangOptions().CPlusPlus) { Diag(OpLoc, diag::err_typecheck_address_of) << "register variable" << op->getSourceRange(); return QualType(); |