instantiate-function-params.cpp revision c7e6fde0411680a8aac9abaab7a3c444929ecd3e
1c7e6fde0411680a8aac9abaab7a3c444929ecd3eDouglas Gregor// RUN: %clang_cc1 -fsyntax-only -verify %s
2c7e6fde0411680a8aac9abaab7a3c444929ecd3eDouglas Gregor
3c7e6fde0411680a8aac9abaab7a3c444929ecd3eDouglas Gregor// PR6619
4c7e6fde0411680a8aac9abaab7a3c444929ecd3eDouglas Gregortemplate<bool C> struct if_c { };
5c7e6fde0411680a8aac9abaab7a3c444929ecd3eDouglas Gregortemplate<typename T1> struct if_ {
6c7e6fde0411680a8aac9abaab7a3c444929ecd3eDouglas Gregor  typedef if_c< static_cast<bool>(T1::value)> almost_type_; // expected-note 7{{in instantiation}}
7c7e6fde0411680a8aac9abaab7a3c444929ecd3eDouglas Gregor};
8c7e6fde0411680a8aac9abaab7a3c444929ecd3eDouglas Gregortemplate <class Model, void (Model::*)()> struct wrap_constraints { };
9c7e6fde0411680a8aac9abaab7a3c444929ecd3eDouglas Gregortemplate <class Model>
10c7e6fde0411680a8aac9abaab7a3c444929ecd3eDouglas Gregorinline char has_constraints_(Model* ,  // expected-note 4{{while substituting}} \
11c7e6fde0411680a8aac9abaab7a3c444929ecd3eDouglas Gregor                             // expected-note 3{{candidate template ignored}}
12c7e6fde0411680a8aac9abaab7a3c444929ecd3eDouglas Gregor                               wrap_constraints<Model,&Model::constraints>* = 0); // expected-note 4{{in instantiation}}
13c7e6fde0411680a8aac9abaab7a3c444929ecd3eDouglas Gregor
14c7e6fde0411680a8aac9abaab7a3c444929ecd3eDouglas Gregortemplate <class Model> struct not_satisfied {
15c7e6fde0411680a8aac9abaab7a3c444929ecd3eDouglas Gregor  static const bool value = sizeof( has_constraints_((Model*)0)  == 1); // expected-error 3{{no matching function}}
16c7e6fde0411680a8aac9abaab7a3c444929ecd3eDouglas Gregor};
17c7e6fde0411680a8aac9abaab7a3c444929ecd3eDouglas Gregortemplate <class ModelFn> struct requirement_;
18c7e6fde0411680a8aac9abaab7a3c444929ecd3eDouglas Gregortemplate <void(*)()> struct instantiate {
19c7e6fde0411680a8aac9abaab7a3c444929ecd3eDouglas Gregor};
20c7e6fde0411680a8aac9abaab7a3c444929ecd3eDouglas Gregortemplate <class Model> struct requirement_<void(*)(Model)>                           : if_<       not_satisfied<Model>         >::type { // expected-error 3{{no type named}} \
21c7e6fde0411680a8aac9abaab7a3c444929ecd3eDouglas Gregor  // expected-note 7{{in instantiation}}
22c7e6fde0411680a8aac9abaab7a3c444929ecd3eDouglas Gregor};
23c7e6fde0411680a8aac9abaab7a3c444929ecd3eDouglas Gregortemplate <class Model> struct usage_requirements {
24c7e6fde0411680a8aac9abaab7a3c444929ecd3eDouglas Gregor};
25c7e6fde0411680a8aac9abaab7a3c444929ecd3eDouglas Gregortemplate < typename TT > struct InputIterator                            {
26c7e6fde0411680a8aac9abaab7a3c444929ecd3eDouglas Gregor    typedef  instantiate< & requirement_<void(*)(usage_requirements<InputIterator> x)>::failed> boost_concept_check1; // expected-note 2{{in instantiation}}
27c7e6fde0411680a8aac9abaab7a3c444929ecd3eDouglas Gregor};
28c7e6fde0411680a8aac9abaab7a3c444929ecd3eDouglas Gregortemplate < typename TT > struct ForwardIterator                              : InputIterator<TT>                              { // expected-note 2{{in instantiation}}
29c7e6fde0411680a8aac9abaab7a3c444929ecd3eDouglas Gregor  typedef instantiate< & requirement_<void(*)(usage_requirements<ForwardIterator> x)>::failed> boost_concept_check2; // expected-note 2 {{in instantiation}}
30c7e6fde0411680a8aac9abaab7a3c444929ecd3eDouglas Gregor
31c7e6fde0411680a8aac9abaab7a3c444929ecd3eDouglas Gregor};
32c7e6fde0411680a8aac9abaab7a3c444929ecd3eDouglas Gregortypedef instantiate< &requirement_<void(*)(ForwardIterator<char*> x)>::failed> boost_concept_checkX; // expected-error{{no member named}} \
33c7e6fde0411680a8aac9abaab7a3c444929ecd3eDouglas Gregor// expected-note 6{{in instantiation}}
34