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