150
|
1 // RUN: %clang_cc1 -std=c++11 %s -emit-pch -o %t.pch
|
|
2 // RUN: %clang_cc1 -fsyntax-only -std=c++11 %s -include-pch %t.pch -verify
|
207
|
3
|
|
4 // RUN: %clang_cc1 -std=c++11 %s -emit-pch -fpch-instantiate-templates -o %t.pch
|
|
5 // RUN: %clang_cc1 -fsyntax-only -std=c++11 %s -include-pch %t.pch -verify
|
|
6
|
150
|
7 // expected-no-diagnostics
|
|
8
|
|
9 // rdar://12631281
|
|
10 // This reduced test case exposed a use-after-free memory bug, which was reliable
|
|
11 // reproduced only on guarded malloc (and probably valgrind).
|
|
12
|
|
13 #ifndef HEADER
|
|
14 #define HEADER
|
|
15
|
|
16 template < class _T2> struct is_convertible;
|
|
17 template <> struct is_convertible<int> { typedef int type; };
|
|
18
|
|
19 template <class _T1, class _T2> struct pair {
|
|
20 typedef _T1 first_type;
|
|
21 typedef _T2 second_type;
|
|
22 template <class _U1, class _U2, class = typename is_convertible< first_type>::type>
|
|
23 pair(_U1&& , _U2&& ); // expected-note {{candidate}}
|
|
24 };
|
|
25
|
|
26 template <class _ForwardIterator>
|
|
27 pair<_ForwardIterator, _ForwardIterator> __equal_range(_ForwardIterator) {
|
|
28 return pair<_ForwardIterator, _ForwardIterator>(0, 0); // expected-error {{no matching constructor}}
|
|
29 }
|
|
30
|
|
31 template <class _ForwardIterator>
|
|
32 pair<_ForwardIterator, _ForwardIterator> equal_range( _ForwardIterator a) {
|
|
33 return __equal_range(a); // expected-note {{instantiation}}
|
|
34 }
|
|
35
|
|
36 class A {
|
|
37 pair<int, int> range() {
|
|
38 return equal_range(0); // expected-note {{instantiation}}
|
|
39 }
|
|
40 };
|
|
41
|
|
42 #else
|
|
43
|
|
44 #endif
|