1 // RUN: %clang_cc1 -verify -fsyntax-only %s
2 // The diagnostics we produce for this code tickled a bug in raw_ostream.
3 template <typename _Alloc> class allocator;
4 template <class _CharT> struct char_traits;
5 template <typename _CharT, typename _Traits = char_traits<_CharT>,
6           typename _Alloc = allocator<_CharT> >
7 class basic_string;
8 typedef basic_string<wchar_t> wstring;
9 class Closure {
10 };
11 template <class A1> class Callback1 {
12 };
13 template <class A1, class A2> class Callback2 {
14 };
15 template <class R, class A2> class ResultCallback1 {
16 };
17 template <bool del, class R, class T, class P1, class P2, class A1>
18 class AAAAAAAResultCallback_2_1 : public ResultCallback1<R, A1> {
19 };
20 template <bool del, class T, class P1, class P2, class A1>
21 class AAAAAAAResultCallback_2_1< del, void, T, P1, P2, A1> :
22     public Callback1<A1> {
23  public:
24   typedef Callback1<A1> base;
25 };
26 template <class T1, class T2, class R, class P1, class P2, class A1>
27 inline typename AAAAAAAResultCallback_2_1<true, R, T1, P1, P2, A1>::base*
NewCallback(T1 * obj,R (T2::* member)(P1,P2,A1),const P1 & p1,const P2 & p2)28 NewCallback(T1* obj, R(T2::* member)(P1, P2, A1), const P1& p1, const P2& p2) {}
29 namespace util { class Status {}; }
30 class xxxxxxxxxxxxxxxxx {
31   void Bar(wstring* s, util::Status* status,
32            Callback2<util::Status, wstring>* done);
33   void Foo();
34 };
Foo()35 void xxxxxxxxxxxxxxxxx::Foo() {
36   wstring* s = __null;
37   util::Status* status = __null;
38   Closure* cb = NewCallback(this, &xxxxxxxxxxxxxxxxx::Bar, s, status);  // expected-error{{cannot initialize}}
39 }
40