Daniel Dunbar | a572887 | 2009-12-15 20:14:24 +0000 | [diff] [blame^] | 1 | // RUN: %clang_cc1 -fsyntax-only -std=c++0x -verify %s |
Douglas Gregor | 51ffb0c | 2009-11-25 18:55:14 +0000 | [diff] [blame] | 2 | |
| 3 | // Test default template arguments for function templates. |
| 4 | template<typename T = int> |
| 5 | void f0(); |
| 6 | |
| 7 | template<typename T> |
| 8 | void f0(); |
| 9 | |
| 10 | void g0() { |
| 11 | f0(); // okay! |
| 12 | } |
| 13 | |
| 14 | template<typename T, int N = T::value> |
| 15 | int &f1(T); |
| 16 | |
| 17 | float &f1(...); |
| 18 | |
| 19 | struct HasValue { |
| 20 | static const int value = 17; |
| 21 | }; |
| 22 | |
| 23 | void g1() { |
| 24 | float &fr = f1(15); |
| 25 | int &ir = f1(HasValue()); |
| 26 | } |