blob: 039f6df6ed625dddefeb2cf7c677d9ee6b084f04 [file] [log] [blame]
Gabor Greif19de06b2010-08-28 00:45:56 +00001// RUN: %clang %s -S -emit-llvm -o - | grep -e "define linkonce_odr.*_ZlsR11std_ostreamRK8StreamerI3FooE"
Gabor Greifbb452e92010-08-28 00:48:36 +00002// PR8007: friend function not instantiated.
Gabor Greifc620ace2010-08-27 23:39:49 +00003
4struct std_ostream
5{
6 int dummy;
7};
8
9std_ostream cout;
10
11template <typename STRUCT_TYPE>
12struct Streamer
13{
14 friend std_ostream& operator << (std_ostream& o, const Streamer& f)
15 {
16 Streamer s(f);
17 s(o);
18 return o;
19 }
20
21 Streamer(const STRUCT_TYPE& s) : s(s) {}
22
23 const STRUCT_TYPE& s;
24 void operator () (std_ostream&) const;
25};
26
27typedef struct Foo {} Foo;
28
29std_ostream& operator << (std_ostream& o, const Streamer<Foo>& f);
30/*std_ostream& operator << (std_ostream& o, const Streamer<Foo>& f)
31{
32 // Sema should flag this as a redefinition
33}*/
34
35template <>
36void Streamer<Foo>::operator () (std_ostream& o) const
37{
38}
39
Gabor Greifc620ace2010-08-27 23:39:49 +000040int main(void)
41{
Gabor Greifc620ace2010-08-27 23:39:49 +000042 Foo foo;
43 cout << foo;
44}