Douglas Gregor | 3a923c2d | 2009-09-24 23:14:47 +0000 | [diff] [blame] | 1 | // RUN: clang-cc -fsyntax-only -verify %s |
| 2 | |
| 3 | template<int N> void f0(int (&array)[N]); |
| 4 | |
| 5 | // Simple function template specialization (using overloading) |
| 6 | template<> void f0(int (&array)[1]); |
| 7 | |
| 8 | void test_f0() { |
| 9 | int iarr1[1]; |
| 10 | f0(iarr1); |
| 11 | } |
| 12 | |
| 13 | // Function template specialization where there are no matches |
| 14 | template<> void f0(char (&array)[1]); // expected-error{{no function template matches}} |
| 15 | |
| 16 | // Function template specialization that requires partial ordering |
| 17 | template<typename T, int N> void f1(T (&array)[N]); // expected-note{{matches}} |
| 18 | template<int N> void f1(int (&array)[N]); // expected-note{{matches}} |
| 19 | |
| 20 | template<> void f1(float (&array)[1]); |
| 21 | template<> void f1(int (&array)[1]); |
| 22 | |
| 23 | // Function template specialization that results in an ambiguity |
| 24 | template<typename T> void f1(T (&array)[17]); // expected-note{{matches}} |
| 25 | template<> void f1(int (&array)[17]); // expected-error{{ambiguous}} |