diff options
author | Gabor Greif <ggreif@gmail.com> | 2010-08-28 02:00:22 +0000 |
---|---|---|
committer | Gabor Greif <ggreif@gmail.com> | 2010-08-28 02:00:22 +0000 |
commit | aaafddba8b2b7f2f601bd86fdafaefde38da469d (patch) | |
tree | 42eb3b4b719e7c55d6afefef377cefd46ef4d34c | |
parent | be9ebe3747716a916d8b69a7e7a5276919136c87 (diff) |
check whether sema issues a redefinition error
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112347 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | test/SemaTemplate/inject-templated-friend.cpp | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/test/SemaTemplate/inject-templated-friend.cpp b/test/SemaTemplate/inject-templated-friend.cpp index 039f6df6ed..fbe86d9638 100644 --- a/test/SemaTemplate/inject-templated-friend.cpp +++ b/test/SemaTemplate/inject-templated-friend.cpp @@ -1,4 +1,5 @@ // RUN: %clang %s -S -emit-llvm -o - | grep -e "define linkonce_odr.*_ZlsR11std_ostreamRK8StreamerI3FooE" +// RUN: %clang -cc1 %s -DREDEFINE -verify // PR8007: friend function not instantiated. struct std_ostream @@ -11,7 +12,7 @@ std_ostream cout; template <typename STRUCT_TYPE> struct Streamer { - friend std_ostream& operator << (std_ostream& o, const Streamer& f) + friend std_ostream& operator << (std_ostream& o, const Streamer& f) // expected-error{{redefinition of 'operator<<'}} { Streamer s(f); s(o); @@ -26,14 +27,17 @@ struct Streamer typedef struct Foo {} Foo; -std_ostream& operator << (std_ostream& o, const Streamer<Foo>& f); -/*std_ostream& operator << (std_ostream& o, const Streamer<Foo>& f) +std_ostream& operator << (std_ostream&, const Streamer<Foo>&); +#ifdef REDEFINE +std_ostream& operator << (std_ostream& o, const Streamer<Foo>&) // expected-note{{is here}} { // Sema should flag this as a redefinition -}*/ + return o; +} +#endif template <> -void Streamer<Foo>::operator () (std_ostream& o) const +void Streamer<Foo>::operator () (std_ostream& o) const // expected-note{{requested here}} { } |