1 // RUN: %clang_cc1 -triple i686-unknown-unknown -fsyntax-only -verify %s
4 template<bool C
> struct if_c
{ };
5 template<typename T1
> struct if_
{
6 typedef if_c
< static_cast<bool>(T1::value
)> almost_type_
; // expected-note 7{{in instantiation}}
8 template <class Model
, void (Model::*)()> struct wrap_constraints
{ };
10 inline char has_constraints_(Model
* , // expected-note 3{{candidate template ignored}}
11 wrap_constraints
<Model
,&Model::constraints
>* = 0); // expected-note 4{{in instantiation}}
13 template <class Model
> struct not_satisfied
{
14 static const bool value
= sizeof( has_constraints_((Model
*)0) == 1); // expected-error 3{{no matching function}} \
15 // expected-note 4{{while substituting deduced template arguments into function template 'has_constraints_' [with }}
17 template <class ModelFn
> struct requirement_
;
18 template <void(*)()> struct instantiate
{
20 template <class Model
> struct requirement_
<void(*)(Model
)> : if_
< not_satisfied
<Model
> >::type
{ // expected-error 3{{no type named 'type' in}} expected-note 7{{in instantiation}}
22 template <class Model
> struct usage_requirements
{
24 template < typename TT
> struct InputIterator
{
25 typedef instantiate
< & requirement_
<void(*)(usage_requirements
<InputIterator
> x
)>::failed
> boost_concept_check1
; // expected-note 2{{in instantiation}}
27 template < typename TT
> struct ForwardIterator
: InputIterator
<TT
> { // expected-note 2{{in instantiation}}
28 typedef instantiate
< & requirement_
<void(*)(usage_requirements
<ForwardIterator
> x
)>::failed
> boost_concept_check2
; // expected-note 2{{in instantiation}}
31 typedef instantiate
< &requirement_
<void(*)(ForwardIterator
<char*> x
)>::failed
> boost_concept_checkX
;// expected-note 6{{in instantiation}}
33 template<typename T
> struct X0
{ };
34 template<typename R
, typename A1
> struct X0
<R(A1 param
)> { };
36 template<typename T
, typename A1
, typename A2
>
37 void instF0(X0
<T(A1
)> x0a
, X0
<T(A2
)> x0b
) {
42 template void instF0
<int, int, float>(X0
<int(int)>, X0
<int(float)>);
44 template<typename R
, typename A1
, R (*ptr
)(A1
)> struct FuncPtr
{ };
45 template<typename A1
, int (*ptr
)(A1
)> struct FuncPtr
<int, A1
, ptr
> { };
47 template<typename R
, typename A1
> R
unary_func(A1
);
49 template<typename R
, typename A1
, typename A2
>
51 FuncPtr
<R
, A1
, &unary_func
<R
, A1
> > fp1
;
52 FuncPtr
<R
, A2
, &unary_func
<R
, A2
> > fp2
;
55 template void use_func_ptr
<int, float, double>();
58 template < typename
, typename
= int, typename
= int > struct X1
;
62 template <typename
= int *, typename TokenT
= int,
63 typename
= int( X2
<TokenT
> &)>
68 template <typename
, typename P
>
69 struct X3_base
: X3
< X1
<int, P
> >
71 protected: typedef X1
< P
> type
;
75 struct r
: X3_base
<int, int>
80 namespace InstantiateFunctionTypedef
{
83 typedef int functype(int, int);
85 __attribute__((noreturn
)) functype func2
;
87 typedef int stdfunctype(int, int) __attribute__((stdcall));
88 __attribute__((stdcall)) functype stdfunc1
;
91 __attribute__((pcs("aapcs"))) functype pcsfunc
; // expected-warning {{'pcs' calling convention is not supported for this target}}
97 (void)x
.stdfunc1(1, 2);
98 (void)x
.stdfunc2(1, 2);
99 (void)x
.pcsfunc(1, 2);