diff options
author | Douglas Gregor <dgregor@apple.com> | 2010-05-05 22:38:15 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2010-05-05 22:38:15 +0000 |
commit | bf1fb44efa6f2ce36fb19a4bb2778c79179daaf2 (patch) | |
tree | c0b988f8a7123713323985f35095d5eb43e5855a /clang/test/SemaCXX/default-assignment-operator.cpp | |
parent | 92b21cad5d8900e8c4f879bb43474d2f15e3ef20 (diff) | |
download | bcm5719-llvm-bf1fb44efa6f2ce36fb19a4bb2778c79179daaf2.tar.gz bcm5719-llvm-bf1fb44efa6f2ce36fb19a4bb2778c79179daaf2.zip |
When implicit definition of the copy-assignment operator fails,
provide a note that shows where the copy-assignment operator was
needed. We used to have this, but I broke it during refactoring.
Finishes PR6999.
llvm-svn: 103127
Diffstat (limited to 'clang/test/SemaCXX/default-assignment-operator.cpp')
-rw-r--r-- | clang/test/SemaCXX/default-assignment-operator.cpp | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/clang/test/SemaCXX/default-assignment-operator.cpp b/clang/test/SemaCXX/default-assignment-operator.cpp index dee6d131e4a..4b5531e0c87 100644 --- a/clang/test/SemaCXX/default-assignment-operator.cpp +++ b/clang/test/SemaCXX/default-assignment-operator.cpp @@ -1,15 +1,14 @@ // RUN: %clang_cc1 -fsyntax-only -verify %s class Base { // expected-error {{cannot define the implicit default assignment operator for 'Base', because non-static reference member 'ref' can't use default assignment operator}} \ - // expected-warning{{class 'Base' does not declare any constructor to initialize its non-modifiable members}} \ - // expected-note {{synthesized method is first required here}} + // expected-warning{{class 'Base' does not declare any constructor to initialize its non-modifiable members}} int &ref; // expected-note {{declared here}} \ // expected-note{{reference member 'ref' will never be initialized}} }; class X : Base { // // expected-error {{cannot define the implicit default assignment operator for 'X', because non-static const member 'cint' can't use default assignment operator}} \ - // expected-note {{synthesized method is first required here}} -public: +// expected-note{{assignment operator for 'Base' first required here}} +public: X(); const int cint; // expected-note {{declared here}} }; @@ -29,7 +28,7 @@ Z z2; // Test1 void f(X x, const X cx) { - x = cx; + x = cx; // expected-note{{assignment operator for 'X' first required here}} x = cx; z1 = z2; } @@ -74,8 +73,7 @@ void i() { // Test5 -class E1 { // expected-error{{cannot define the implicit default assignment operator for 'E1', because non-static const member 'a' can't use default assignment operator}} \ - // expected-note {{synthesized method is first required here}} +class E1 { // expected-error{{cannot define the implicit default assignment operator for 'E1', because non-static const member 'a' can't use default assignment operator}} public: const int a; // expected-note{{declared here}} @@ -86,7 +84,7 @@ public: E1 e1, e2; void j() { - e1 = e2; + e1 = e2; // expected-note{{assignment operator for 'E1' first required here}} } namespace ProtectedCheck { |