diff options
author | Fariborz Jahanian <fjahanian@apple.com> | 2009-06-25 22:40:36 +0000 |
---|---|---|
committer | Fariborz Jahanian <fjahanian@apple.com> | 2009-06-25 22:40:36 +0000 |
commit | a158e018d4d8aa69390b3edef9a58c27fdacb01c (patch) | |
tree | c1627bb433ff175fbbb686ce36f802e2b215fffb /clang/test/SemaCXX/default-assignment-operator.cpp | |
parent | 0c044ecdb0aab83cc92d296a0c9e6f7dae3d0549 (diff) | |
download | bcm5719-llvm-a158e018d4d8aa69390b3edef9a58c27fdacb01c.tar.gz bcm5719-llvm-a158e018d4d8aa69390b3edef9a58c27fdacb01c.zip |
Test case for my last patch.
llvm-svn: 74216
Diffstat (limited to 'clang/test/SemaCXX/default-assignment-operator.cpp')
-rw-r--r-- | clang/test/SemaCXX/default-assignment-operator.cpp | 74 |
1 files changed, 74 insertions, 0 deletions
diff --git a/clang/test/SemaCXX/default-assignment-operator.cpp b/clang/test/SemaCXX/default-assignment-operator.cpp new file mode 100644 index 00000000000..090ba3c3ca8 --- /dev/null +++ b/clang/test/SemaCXX/default-assignment-operator.cpp @@ -0,0 +1,74 @@ +// RUN: clang-cc -fsyntax-only -verify %s + +class Base { // expected-error {{cannot define the implicit default assignment operator for 'class Base'}} \ + // expected-note {{synthesized method is first required here}} + int &ref; // expected-note {{declared at}} +}; + +class X : Base { // // expected-error {{cannot define the implicit default assignment operator for 'class X'}} +public: + X(); + const int cint; // expected-note {{declared at}} +}; + +struct Y : X { + Y(); + Y& operator=(const Y&); + Y& operator=(volatile Y&); + Y& operator=(const volatile Y&); + Y& operator=(Y&); +}; + +class Z : Y {}; + +Z z1; +Z z2; + +// Test1 +void f(X x, const X cx) { + x = cx; // expected-note {{synthesized method is first required here}} + x = cx; + z1 = z2; +} + +// Test2 +class T {}; +T t1; +T t2; + +void g() +{ + t1 = t2; +} + +// Test3 +class V { +public: + V(); + V &operator = (V &b); +}; + +class W : V {}; +W w1, w2; + +void h() +{ + w1 = w2; +} + +// Test4 + +class B1 { +public: + B1(); + B1 &operator = (B1 b); +}; + +class D1 : B1 {}; +D1 d1, d2; + +void i() +{ + d1 = d2; +} + |