aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2012-09-10 14:57:06 +0000
committerDouglas Gregor <dgregor@apple.com>2012-09-10 14:57:06 +0000
commit0cb8939851364eb37a0f8bf8bb47874b7d966915 (patch)
treee857b33715e306abadf62c78125df92582270f70
parent18857f7a1ff88469283b9e87384bdf5c8a274ca6 (diff)
downloadclang-0cb8939851364eb37a0f8bf8bb47874b7d966915.tar.gz
Allow vector types in pseudo-destructor expressions. Fixes PR13798.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@163514 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Sema/SemaExprCXX.cpp3
-rw-r--r--test/SemaCXX/vector.cpp11
2 files changed, 13 insertions, 1 deletions
diff --git a/lib/Sema/SemaExprCXX.cpp b/lib/Sema/SemaExprCXX.cpp
index 4efab1b83b..0905607e72 100644
--- a/lib/Sema/SemaExprCXX.cpp
+++ b/lib/Sema/SemaExprCXX.cpp
@@ -5045,7 +5045,8 @@ ExprResult Sema::BuildPseudoDestructorExpr(Expr *Base,
if (CheckArrow(*this, ObjectType, Base, OpKind, OpLoc))
return ExprError();
- if (!ObjectType->isDependentType() && !ObjectType->isScalarType()) {
+ if (!ObjectType->isDependentType() && !ObjectType->isScalarType() &&
+ !ObjectType->isVectorType()) {
if (getLangOpts().MicrosoftMode && ObjectType->isVoidType())
Diag(OpLoc, diag::ext_pseudo_dtor_on_void) << Base->getSourceRange();
else
diff --git a/test/SemaCXX/vector.cpp b/test/SemaCXX/vector.cpp
index 82245ac29b..4d2d064b32 100644
--- a/test/SemaCXX/vector.cpp
+++ b/test/SemaCXX/vector.cpp
@@ -267,3 +267,14 @@ void test_mixed_vector_types(fltx4 f, intx4 n, flte4 g, flte4 m) {
(void)(n *= m);
(void)(n /= m);
}
+
+template<typename T> void test_pseudo_dtor_tmpl(T *ptr) {
+ ptr->~T();
+ (*ptr).~T();
+}
+
+void test_pseudo_dtor(fltx4 *f) {
+ f->~fltx4();
+ (*f).~fltx4();
+ test_pseudo_dtor_tmpl(f);
+}