Fix the clang-wpa example.
[clang.git] / test / CodeGenCXX / template-anonymous-types.cpp
blob68bdc0c4a47dcede559dc1ffea20dc00bbbd8519
1 // RUN: %clang_cc1 %s -triple x86_64-unknown-linux-gnu -emit-llvm -o - | FileCheck %s
3 struct S {
4 enum { FOO = 42 };
5 enum { BAR = 42 };
6 };
8 template <typename T> struct X {
9 T value;
10 X(T t) : value(t) {}
11 int f() { return value; }
14 template <typename T> int f(T t) {
15 X<T> x(t);
16 return x.f();
19 void test() {
20 // Look for two instantiations, entirely internal to this TU, one for FOO's
21 // type and one for BAR's.
22 // CHECK: define internal i32 @"_Z1fIN1S3$_0EEiT_"(i32 %t)
23 (void)f(S::FOO);
24 // CHECK: define internal i32 @"_Z1fIN1S3$_1EEiT_"(i32 %t)
25 (void)f(S::BAR);
27 // Now check for the class template instantiations. Annoyingly, they are in
28 // reverse order.
30 // BAR's instantiation of X:
31 // CHECK: define internal i32 @"_ZN1XIN1S3$_1EE1fEv"(%struct.X* %this)
32 // CHECK: define internal void @"_ZN1XIN1S3$_1EEC2ES1_"(%struct.X* %this, i32 %t) unnamed_addr
34 // FOO's instantiation of X:
35 // CHECK: define internal i32 @"_ZN1XIN1S3$_0EE1fEv"(%struct.X* %this)
36 // CHECK: define internal void @"_ZN1XIN1S3$_0EEC2ES1_"(%struct.X* %this, i32 %t) unnamed_addr