summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen
diff options
context:
space:
mode:
authorDavid Majnemer <david.majnemer@gmail.com>2015-04-04 05:37:48 +0000
committerDavid Majnemer <david.majnemer@gmail.com>2015-04-04 05:37:48 +0000
commitf205f5324bca303a997d383d3a9b7014f79fdfdc (patch)
tree3c990207c524ec1069dec578960bd61798a3308c /clang/lib/CodeGen
parent1d359d3b5ba69cbfe39b372bfd31447d51ac812b (diff)
downloadbcm5719-llvm-f205f5324bca303a997d383d3a9b7014f79fdfdc.tar.gz
bcm5719-llvm-f205f5324bca303a997d383d3a9b7014f79fdfdc.zip
[MS ABI] A pointer-to-function cannot be caught as a pointer-to-void
Don't assume that all pointers are convertible to void pointer. Instead correctly respect [conv.ptr]p2; only allow pointer types with an object pointee type to be caught as pointer-to-void. llvm-svn: 234090
Diffstat (limited to 'clang/lib/CodeGen')
-rw-r--r--clang/lib/CodeGen/MicrosoftCXXABI.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/clang/lib/CodeGen/MicrosoftCXXABI.cpp b/clang/lib/CodeGen/MicrosoftCXXABI.cpp
index a5e3f665ee5..dff7d6090d1 100644
--- a/clang/lib/CodeGen/MicrosoftCXXABI.cpp
+++ b/clang/lib/CodeGen/MicrosoftCXXABI.cpp
@@ -3597,9 +3597,10 @@ llvm::GlobalVariable *MicrosoftCXXABI::getCatchableTypeArray(QualType T) {
// - a standard pointer conversion (4.10) not involving conversions to
// pointers to private or protected or ambiguous classes
//
- // All pointers are convertible to pointer-to-void so ensure that it is in the
- // CatchableTypeArray.
- if (IsPointer)
+ // C++14 [conv.ptr]p2:
+ // A prvalue of type "pointer to cv T," where T is an object type, can be
+ // converted to a prvalue of type "pointer to cv void".
+ if (IsPointer && T->getPointeeType()->isObjectType())
CatchableTypes.insert(getCatchableType(getContext().VoidPtrTy));
// C++14 [except.handle]p3:
OpenPOWER on IntegriCloud