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