summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn McCall <rjmccall@apple.com>2013-04-16 22:32:04 +0000
committerJohn McCall <rjmccall@apple.com>2013-04-16 22:32:04 +0000
commit0d9dd73847a3ce679f7f17e113158e9ecb9ce04e (patch)
treebeb53330a9af8864d2963d612fae477e78bcbada
parent095c58f1c43d3448827be16312c191563eeb1161 (diff)
downloadbcm5719-llvm-0d9dd73847a3ce679f7f17e113158e9ecb9ce04e.tar.gz
bcm5719-llvm-0d9dd73847a3ce679f7f17e113158e9ecb9ce04e.zip
Don't put too much thought into whether or not to capture a
type-dependent intermediate result in a postfix ++ pseudo- object operation. Test case by Tong Shen. llvm-svn: 179637
-rw-r--r--clang/lib/Sema/SemaPseudoObject.cpp3
-rw-r--r--clang/test/SemaCXX/MicrosoftExtensions.cpp9
2 files changed, 7 insertions, 5 deletions
diff --git a/clang/lib/Sema/SemaPseudoObject.cpp b/clang/lib/Sema/SemaPseudoObject.cpp
index 560efa5a4ef..795cfbacfba 100644
--- a/clang/lib/Sema/SemaPseudoObject.cpp
+++ b/clang/lib/Sema/SemaPseudoObject.cpp
@@ -441,7 +441,8 @@ PseudoOpBuilder::buildIncDecOperation(Scope *Sc, SourceLocation opcLoc,
QualType resultType = result.get()->getType();
// That's the postfix result.
- if (UnaryOperator::isPostfix(opcode) && CanCaptureValueOfType(resultType)) {
+ if (UnaryOperator::isPostfix(opcode) &&
+ (result.get()->isTypeDependent() || CanCaptureValueOfType(resultType))) {
result = capture(result.take());
setResultToLastSemantic();
}
diff --git a/clang/test/SemaCXX/MicrosoftExtensions.cpp b/clang/test/SemaCXX/MicrosoftExtensions.cpp
index 07b93face95..ab3ff69f27b 100644
--- a/clang/test/SemaCXX/MicrosoftExtensions.cpp
+++ b/clang/test/SemaCXX/MicrosoftExtensions.cpp
@@ -302,13 +302,14 @@ struct SP9 {
T GetV() { return 0; }
void SetV(T v) {}
void f() { V = this->V; V < this->V; }
- //void g() { V++; }
- //void h() { V*=2; }
+ void g() { V++; }
+ void h() { V*=2; }
};
struct SP10 {
SP10(int v) {}
bool operator<(const SP10& v) { return true; }
SP10 operator*(int v) { return *this; }
+ SP10 operator+(int v) { return *this; }
SP10& operator=(const SP10& v) { return *this; }
};
void TestSP9() {
@@ -329,6 +330,6 @@ void TestSP9() {
SP9<SP10> c3;
c3.f(); // Overloaded binary op operand
- //c3.g(); // Overloaded incdec op operand
- //c3.h(); // Overloaded unary op operand
+ c3.g(); // Overloaded incdec op operand
+ c3.h(); // Overloaded unary op operand
}
OpenPOWER on IntegriCloud