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