diff options
Diffstat (limited to 'test/SemaCXX/default-assignment-operator.cpp')
-rw-r--r-- | test/SemaCXX/default-assignment-operator.cpp | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/test/SemaCXX/default-assignment-operator.cpp b/test/SemaCXX/default-assignment-operator.cpp index baae03c..a04de37 100644 --- a/test/SemaCXX/default-assignment-operator.cpp +++ b/test/SemaCXX/default-assignment-operator.cpp @@ -1,13 +1,17 @@ // 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}} - int &ref; // expected-note {{declared at}} +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}} + 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}} +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: X(); - const int cint; // expected-note {{declared at}} + const int cint; // expected-note {{declared here}} }; struct Y : X { @@ -25,7 +29,7 @@ Z z2; // Test1 void f(X x, const X cx) { - x = cx; // expected-note 2 {{synthesized method is first required here}} + x = cx; x = cx; z1 = z2; } @@ -70,9 +74,11 @@ 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}} +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}} + public: - const int a; // expected-note{{declared at}} + const int a; // expected-note{{declared here}} E1() : a(0) {} }; @@ -80,6 +86,6 @@ public: E1 e1, e2; void j() { - e1 = e2; // expected-note{{synthesized method is first required here}} + e1 = e2; } |