[Heikki Kultala] This patch contains the ABI changes for the TCE target.
[clang.git] / test / CodeGenCXX / member-initializers.cpp
blob244a164b9fe2d8ddbd6f3070b89f1fa005017d43
1 // RUN: %clang_cc1 -emit-llvm %s -o - -triple=x86_64-apple-darwin10 -O3 | FileCheck %s
3 struct A {
4 virtual int f() { return 1; }
5 };
7 struct B : A {
8 B() : i(f()) { }
10 virtual int f() { return 2; }
12 int i;
15 // CHECK: define i32 @_Z1fv() nounwind
16 int f() {
17 B b;
19 // CHECK: ret i32 2
20 return b.i;
23 // Test that we don't try to fold the default value of j when initializing i.
24 // CHECK: define i32 @_Z9test_foldv() nounwind
25 int test_fold() {
26 struct A {
27 A(const int j = 1) : i(j) { }
28 int i;
31 // CHECK: ret i32 2
32 return A(2).i;