summaryrefslogtreecommitdiffstats
path: root/test/CodeGenCXX/derived-to-base-conv.cpp
diff options
context:
space:
mode:
authorFariborz Jahanian <fjahanian@apple.com>2009-10-19 19:18:20 +0000
committerFariborz Jahanian <fjahanian@apple.com>2009-10-19 19:18:20 +0000
commit3759a0361ec00e03584cb6f9ce64fb1f1c947336 (patch)
tree743981d8b79d367da3e1394c9f704d9a995f74b8 /test/CodeGenCXX/derived-to-base-conv.cpp
parent86aa0cdfd5aa7b099efbcd612a014d1b5f0ff799 (diff)
Copy conversion of an expression to its base class
is a standard convesion and not a user-defined conversion. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84525 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGenCXX/derived-to-base-conv.cpp')
-rw-r--r--test/CodeGenCXX/derived-to-base-conv.cpp28
1 files changed, 28 insertions, 0 deletions
diff --git a/test/CodeGenCXX/derived-to-base-conv.cpp b/test/CodeGenCXX/derived-to-base-conv.cpp
index 218116e346..0c89019511 100644
--- a/test/CodeGenCXX/derived-to-base-conv.cpp
+++ b/test/CodeGenCXX/derived-to-base-conv.cpp
@@ -5,6 +5,7 @@
// RUN: true
extern "C" int printf(...);
+extern "C" void exit(int);
struct A {
A (const A&) { printf("A::A(const A&)\n"); }
@@ -44,8 +45,35 @@ int main()
func(x);
}
+struct Base;
+
+struct Root {
+ operator Base&() { exit(1); }
+};
+
+struct Derived;
+
+struct Base : Root {
+ Base(const Base&) { printf("Base::(const Base&)\n"); }
+ Base() { printf("Base::Base()\n"); }
+ operator Derived&() { exit(1); }
+};
+
+struct Derived : Base {
+};
+
+void foo(Base) {}
+
+void test(Derived bb)
+{
+ // CHECK-LP64-NOT: call __ZN4BasecvR7DerivedEv
+ // CHECK-LP32-NOT: call L__ZN4BasecvR7DerivedEv
+ foo(bb);
+}
// CHECK-LP64: call __ZN1XcvR1BEv
// CHECK-LP64: call __ZN1AC1ERKS_
// CHECK-LP32: call L__ZN1XcvR1BEv
// CHECK-LP32: call L__ZN1AC1ERKS_
+
+