Richard Trieu | 5cb3d69 | 2011-07-28 00:19:05 +0000 | [diff] [blame^] | 1 | // RUN: %clang_cc1 -ast-dump %s | FileCheck %s |
| 2 | |
| 3 | template <int X, typename Y, int Z = 5> |
| 4 | struct foo { |
| 5 | int constant; |
| 6 | foo() {} |
| 7 | Y getSum() { return Y(X + Z); } |
| 8 | }; |
| 9 | |
| 10 | template <int A, typename B> |
| 11 | B bar() { |
| 12 | return B(A); |
| 13 | } |
| 14 | |
| 15 | void 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() |