1 // RUN: %clang_cc1 -fsyntax-only -verify %s
2 // RUN: %clang_cc1 -fsyntax-only -verify -std=c++98 %s
3 // RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s
5 template<typename _Alloc
> class allocator
;
6 template<class _CharT
> struct char_traits
;
7 template<typename _CharT
, typename _Traits
= char_traits
<_CharT
>,
8 typename _Alloc
= allocator
<_CharT
> >
10 template<typename _CharT
, typename _Traits
, typename _Alloc
>
11 const typename basic_string
<_CharT
, _Traits
, _Alloc
>::size_type
12 basic_string
<_CharT
, _Traits
, _Alloc
>::_Rep::_S_max_size
// expected-error{{no member named '_Rep' in 'basic_string<_CharT, _Traits, _Alloc>'}}
13 = (((npos
- sizeof(_Rep_base
))/sizeof(_CharT
)) - 1) / 4;
25 template<typename T
> struct a
: T
{
27 int aa() { return p
; } // expected-error{{use of undeclared identifier 'p'}}
31 namespace rdar8605381
{
34 struct Y
{ // expected-note{{candidate constructor (the implicit copy constructor) not viable}}
35 #if __cplusplus >= 201103L // C++11 or later
36 // expected-note@-2 {{candidate constructor (the implicit move constructor) not viable}}
45 new Y
// expected-error{{no viable conversion}}
49 // http://llvm.org/PR8234
51 template<typename Signature
>
56 template<typename R
, typename ARG_TYPE0
>
57 class callback
<R( ARG_TYPE0
)>
63 template< typename ARG_TYPE0
>
64 class callback
<void( ARG_TYPE0
)>
72 callback
<void(const int&)> op
;
79 yyy
= sizeof(struct foo
*)
86 class InfallibleTArray
{
90 operator const InfallibleTArray
&() const;
93 operator const CompVariant
&() const;
95 void Write(const Variant
& __v
);
96 void Write(const InfallibleTArray
& __v
);
104 template<typename T
> class C
;
105 template<typename T
> void f() {
106 if (C
<T
> == 1) // expected-error{{expected unqualified-id}}
111 namespace rdar11806334
{
118 cc_rgb( uint p
); // expected-error {{unknown type name}}
119 cc_rgb( cc_YCbCr v_in
);
132 cc_YCbCr( const cc_rgb v_in
);
135 cc_YCbCr
cc_hsl::YCbCr()
137 cc_YCbCr v_out
= cc_YCbCr( rgb());
144 int getString(const int*);
145 template<int a
> class ELFObjectFile
{
150 int SectionName(getString(sh
));
156 struct fltSemantics
;
157 const fltSemantics
&foobar();
158 void VisitCastExpr(int x
) {
161 const fltSemantics
&Sem
= foobar();
169 static int nsCSSRect::* sides
;
171 void ParseBoxCornerRadii(int y
) {
174 int& x
= dimenX
.*sides
;
179 template<typename
> struct bs
{
181 static int* member(); // expected-note{{possible target}}
182 member(); // expected-error{{a type specifier is required for all declarations}}
183 static member(); // expected-error{{a type specifier is required for all declarations}}
184 static int* member(int); // expected-note{{possible target}}
187 template<typename T
> bs
<T
>::bs() { member
; } // expected-error{{did you mean to call it}}
190 return bs
<int>(); // expected-note{{in instantiation}}
195 template<class _Alloc
> class allocator
{};
196 template<class _CharT
> struct char_traits
;
197 struct input_iterator_tag
{};
198 struct forward_iterator_tag
: public input_iterator_tag
{};
200 template<typename _CharT
, typename _Traits
, typename _Alloc
> struct basic_string
{
201 struct _Alloc_hider
: _Alloc
{ _Alloc_hider(_CharT
*, const _Alloc
&); };
202 mutable _Alloc_hider _M_dataplus
;
203 template<class _InputIterator
> basic_string(_InputIterator __beg
, _InputIterator __end
, const _Alloc
& __a
= _Alloc());
204 template<class _InIterator
> static _CharT
* _S_construct(_InIterator __beg
, _InIterator __end
, const _Alloc
& __a
, input_iterator_tag
);
205 template<class _FwdIterator
> static _CharT
* _S_construct(_FwdIterator __beg
, _FwdIterator __end
, const _Alloc
& __a
, forward_iterator_tag
);
206 static _CharT
* _S_construct(size_type __req
, _CharT __c
, const _Alloc
& __a
); // expected-error{{unknown type name 'size_type'}}
209 template<typename _CharT
, typename _Traits
, typename _Alloc
>
210 template<typename _InputIterator
>
211 basic_string
<_CharT
, _Traits
, _Alloc
>:: basic_string(_InputIterator __beg
, _InputIterator __end
, const _Alloc
& __a
)
212 : _M_dataplus(_S_construct(__beg
, __end
, __a
, input_iterator_tag()), __a
) {}
214 template<typename _CharT
, typename _Traits
= char_traits
<_CharT
>, typename _Alloc
= allocator
<_CharT
> > struct basic_stringbuf
{
215 typedef _CharT char_type
;
216 typedef basic_string
<char_type
, _Traits
, _Alloc
> __string_type
;
217 __string_type
str() const {__string_type((char_type
*)0,(char_type
*)0);}
220 template class basic_stringbuf
<char>;
226 C
tpl_mem(T
*) { return } // expected-error{{expected expression}}
238 appendList(int[]...); // expected-error {{a type specifier is required for all declarations}}
239 appendList(int[]...) { } // expected-error {{a type specifier is required for all declarations}}