summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/ExprConstant.cpp
diff options
context:
space:
mode:
authorReid Kleckner <rnk@google.com>2017-06-23 22:39:01 +0000
committerReid Kleckner <rnk@google.com>2017-06-23 22:39:01 +0000
commit33d501f7d13c5d321ad3fce99b8e1c91becde075 (patch)
tree25f010a482fe63aa4bf93d2a3fa291f2466c7dad /clang/lib/AST/ExprConstant.cpp
parent53dbfb3798e8981634d80fcb4be99656d5483428 (diff)
downloadbcm5719-llvm-33d501f7d13c5d321ad3fce99b8e1c91becde075.tar.gz
bcm5719-llvm-33d501f7d13c5d321ad3fce99b8e1c91becde075.zip
Revert "[MS] Don't statically initialize dllimport member function pointers"
This reverts commit r306137. It has problems on code like this: struct __declspec(dllimport) Foo { int a; int get_a() { return a; } }; template <int (Foo::*Getter)()> struct HasValue { int operator()(Foo *p) { return (p->*Getter)(); } }; int main() { Foo f; f.a = 3; int x = HasValue<&Foo::get_a>()(&f); } llvm-svn: 306175
Diffstat (limited to 'clang/lib/AST/ExprConstant.cpp')
-rw-r--r--clang/lib/AST/ExprConstant.cpp16
1 files changed, 0 insertions, 16 deletions
diff --git a/clang/lib/AST/ExprConstant.cpp b/clang/lib/AST/ExprConstant.cpp
index 60f8143c137..768947d00ac 100644
--- a/clang/lib/AST/ExprConstant.cpp
+++ b/clang/lib/AST/ExprConstant.cpp
@@ -1665,19 +1665,6 @@ static bool CheckLValueConstantExpression(EvalInfo &Info, SourceLocation Loc,
return true;
}
-/// Member pointers are constant expressions unless they point to a
-/// non-virtual dllimport member function.
-static bool CheckMemberPointerConstantExpression(EvalInfo &Info,
- SourceLocation Loc,
- QualType Type,
- const APValue &Value) {
- const ValueDecl *Member = Value.getMemberPointerDecl();
- const auto *FD = dyn_cast_or_null<CXXMethodDecl>(Member);
- if (!FD)
- return true;
- return FD->isVirtual() || !FD->hasAttr<DLLImportAttr>();
-}
-
/// Check that this core constant expression is of literal type, and if not,
/// produce an appropriate diagnostic.
static bool CheckLiteralType(EvalInfo &Info, const Expr *E,
@@ -1770,9 +1757,6 @@ static bool CheckConstantExpression(EvalInfo &Info, SourceLocation DiagLoc,
return CheckLValueConstantExpression(Info, DiagLoc, Type, LVal);
}
- if (Value.isMemberPointer())
- return CheckMemberPointerConstantExpression(Info, DiagLoc, Type, Value);
-
// Everything else is fine.
return true;
}
OpenPOWER on IntegriCloud