Patch to ir-gen user-defined conversions used in expressions
[12.3.2-p3]
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80436 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/test/CodeGenCXX/conversion-function.cpp b/test/CodeGenCXX/conversion-function.cpp
index f3c0e33..e7820bb 100644
--- a/test/CodeGenCXX/conversion-function.cpp
+++ b/test/CodeGenCXX/conversion-function.cpp
@@ -39,6 +39,22 @@
Y y;
+int count=0;
+class O { // ...
+public:
+ operator int(){ return ++iO; }
+ O() : iO(count++) {}
+ int iO;
+};
+
+void g(O a, O b)
+{
+ int i = (a) ? 1+a : 0;
+ int j = (a&&b) ? a+b : i;
+ if (a) { }
+ printf("i = %d j = %d a.iO = %d b.iO = %d\n", i, j, a.iO, b.iO);
+}
+
int main() {
int c = X(Z(y)); // OK: y.operator Z().operator X().operator int()
printf("c = %d\n", c);
@@ -58,6 +74,8 @@
int e = (int)((X)((Z)y));
printf("e = %d\n", e);
+ O o1, o2;
+ g(o1, o2);
}
// CHECK-LP64: .globl __ZN1ScviEv
// CHECK-LP64-NEXT: __ZN1ScviEv: