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