blob: 4cfd7a5843f01bd601db01a9788277456b3eb397 [file] [log] [blame]
Richard Smith9ca5c422011-10-13 22:29:44 +00001// RUN: %clang_cc1 -fsyntax-only -std=c++11 -verify %s
Andy Gibbsc6e68da2012-10-19 12:44:48 +00002// expected-no-diagnostics
Douglas Gregor5c80a27b2009-11-25 18:55:14 +00003
4// Test default template arguments for function templates.
5template<typename T = int>
6void f0();
7
8template<typename T>
9void f0();
10
11void g0() {
12 f0(); // okay!
13}
14
15template<typename T, int N = T::value>
16int &f1(T);
17
18float &f1(...);
19
20struct HasValue {
21 static const int value = 17;
22};
23
24void g1() {
25 float &fr = f1(15);
26 int &ir = f1(HasValue());
27}
David Majnemer89189202013-08-28 23:48:32 +000028
29namespace PR16689 {
30 template <typename T1, typename T2> class tuple {
31 public:
32 template <typename = T2>
33 constexpr tuple() {}
34 };
35 template <class X, class... Y> struct a : public X {
36 using X::X;
37 };
38 auto x = a<tuple<int, int> >();
39}
40
41namespace PR16975 {
42 template <typename...> struct is {
43 constexpr operator bool() const { return false; }
44 };
45
46 template <typename... Types>
47 struct bar {
48 template <typename T,
49 bool = is<Types...>()>
50 bar(T);
51 };
52
53 struct baz : public bar<> {
54 using bar::bar;
55 };
56
57 baz data{0};
58}