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