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