Added operator overloading for unary operators, post-increment, and
post-decrement, including support for generating all of the built-in
operator candidates for these operators. 

C++ and C have different rules for the arguments to the builtin unary
'+' and '-'. Implemented both variants in Sema::ActOnUnaryOp.

In C++, pre-increment and pre-decrement return lvalues. Update
Expr::isLvalue accordingly.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59638 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/test/SemaCXX/overloaded-operator.cpp b/test/SemaCXX/overloaded-operator.cpp
index c540c2d..2948656 100644
--- a/test/SemaCXX/overloaded-operator.cpp
+++ b/test/SemaCXX/overloaded-operator.cpp
@@ -69,3 +69,31 @@
   float &f3 = (e1 == enum2); 
   float &f4 = (enum1 == enum2);  // expected-error{{non-const reference to type 'float' cannot be initialized with a temporary of type '_Bool'}}
 }
+
+
+struct PostInc {
+  PostInc operator++(int);
+  PostInc& operator++();
+};
+
+struct PostDec {
+  PostDec operator--(int);
+  PostDec& operator--();
+};
+
+void incdec_test(PostInc pi, PostDec pd) {
+  const PostInc& pi1 = pi++;
+  const PostDec& pd1 = pd--;
+  PostInc &pi2 = ++pi;
+  PostDec &pd2 = --pd;
+}
+
+struct SmartPtr {
+  int& operator*();
+  // FIXME: spurious error:  long& operator*() const;
+};
+
+void test_smartptr(SmartPtr ptr, const SmartPtr cptr) {
+  int &ir = *ptr;
+  // FIXME: reinstate long &lr = *cptr;
+}