blob: ea3455679d564cd9df8ce17db1c5f10f9002deb5 [file] [log] [blame]
NAKAMURA Takumia26da1a2011-07-28 12:10:58 +00001// RxUN: %clang_cc1 -ast-dump %s | FileCheck %s
2// RUN: %clang_cc1 -ast-dump %s > /dev/null
Richard Trieu5cb3d692011-07-28 00:19:05 +00003
4template <int X, typename Y, int Z = 5>
5struct foo {
6 int constant;
7 foo() {}
8 Y getSum() { return Y(X + Z); }
9};
10
11template <int A, typename B>
12B bar() {
13 return B(A);
14}
15
16void baz() {
17 int x = bar<5, int>();
18 int y = foo<5, int>().getSum();
19 double z = foo<2, double, 3>().getSum();
20}
21
22// Template instantiation - foo
23// CHECK: template <int X = 5, typename Y = int, int Z = 5> struct foo {
24// CHECK: template <int X = 2, typename Y = double, int Z = 3> struct foo {
25
26// Template definition - foo
27// CHECK: template <int X, typename Y, int Z = (IntegerLiteral {{.*}} 'int' 5)
28
29// Template instantiation - bar
30// CHECK: template <int A = 5, typename B = int> int bar()
31
32// Template definition - bar
33// CHECK: template <int A, typename B> B bar()