instantiate-function-params.cpp revision 2b0749a4f8965d0205bf77322db150c13c39e3be
1// RUN: %clang_cc1 -fsyntax-only -verify %s 2 3// PR6619 4template<bool C> struct if_c { }; 5template<typename T1> struct if_ { 6 typedef if_c< static_cast<bool>(T1::value)> almost_type_; // expected-note 7{{in instantiation}} 7}; 8template <class Model, void (Model::*)()> struct wrap_constraints { }; 9template <class Model> 10inline char has_constraints_(Model* , // expected-note 4{{while substituting}} \ 11 // expected-note 3{{candidate template ignored}} 12 wrap_constraints<Model,&Model::constraints>* = 0); // expected-note 4{{in instantiation}} 13 14template <class Model> struct not_satisfied { 15 static const bool value = sizeof( has_constraints_((Model*)0) == 1); // expected-error 3{{no matching function}} 16}; 17template <class ModelFn> struct requirement_; 18template <void(*)()> struct instantiate { 19}; 20template <class Model> struct requirement_<void(*)(Model)> : if_< not_satisfied<Model> >::type { // expected-error 3{{no type named}} \ 21 // expected-note 7{{in instantiation}} 22}; 23template <class Model> struct usage_requirements { 24}; 25template < typename TT > struct InputIterator { 26 typedef instantiate< & requirement_<void(*)(usage_requirements<InputIterator> x)>::failed> boost_concept_check1; // expected-note 2{{in instantiation}} 27}; 28template < typename TT > struct ForwardIterator : InputIterator<TT> { // expected-note 2{{in instantiation}} 29 typedef instantiate< & requirement_<void(*)(usage_requirements<ForwardIterator> x)>::failed> boost_concept_check2; // expected-note 2 {{in instantiation}} 30 31}; 32typedef instantiate< &requirement_<void(*)(ForwardIterator<char*> x)>::failed> boost_concept_checkX; // expected-error{{no member named}} \ 33// expected-note 6{{in instantiation}} 34 35template<typename T> struct X0 { }; 36template<typename R, typename A1> struct X0<R(A1 param)> { }; 37 38template<typename T, typename A1, typename A2> 39void instF0(X0<T(A1)> x0a, X0<T(A2)> x0b) { 40 X0<T(A1)> x0c; 41 X0<T(A2)> x0d; 42} 43 44template void instF0<int, int, float>(X0<int(int)>, X0<int(float)>); 45