1 // RUN: %clang %s -S -emit-llvm -o - | grep -e "define linkonce_odr.*_ZlsR11std_ostreamRK8StreamerI3FooE"
2 // RUN: %clang %s -S -emit-llvm -o - -DPROTOTYPE | grep -e "define linkonce_odr.*_ZlsR11std_ostreamRK8StreamerI3FooE"
3 // RUN: %clang %s -S -emit-llvm -o - -DINSTANTIATE | grep -e "define linkonce_odr.*_ZlsR11std_ostreamRK8StreamerI3FooE"
4 // RUN: %clang %s -S -emit-llvm -o - -DPROTOTYPE -DINSTANTIATE | grep -e "define linkonce_odr.*_ZlsR11std_ostreamRK8StreamerI3FooE"
5 // RUN: %clang_cc1 %s -DREDEFINE -verify
6 // RUN: %clang_cc1 %s -DPROTOTYPE -DREDEFINE -verify
7 // PR8007: friend function not instantiated, reordered version.
8 // Corresponds to http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38392
17 template <typename STRUCT_TYPE
>
20 typedef struct Foo
{} Foo
;
22 std_ostream
& operator << (std_ostream
&, const Streamer
<Foo
>&);
24 void test(const Streamer
<Foo
>& foo
)
29 template <typename STRUCT_TYPE
>
32 friend std_ostream
& operator << (std_ostream
& o
, const Streamer
& f
) // expected-error{{redefinition of 'operator<<'}}
39 Streamer(const STRUCT_TYPE
& s
) : s(s
) {}
42 void operator () (std_ostream
&) const;
46 std_ostream
& operator << (std_ostream
&, const Streamer
<Foo
>&);
50 template struct Streamer
<Foo
>;
54 std_ostream
& operator << (std_ostream
& o
, const Streamer
<Foo
>&) // expected-note{{is here}}
62 void Streamer
<Foo
>::operator () (std_ostream
& o
) const // expected-note{{requested here}}