diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2012-04-05 01:13:04 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2012-04-05 01:13:04 +0000 |
commit | fa0a1f531f7d31ef90419c2ef36bfa0060a73b2c (patch) | |
tree | d9dfcbd3d451555be70266b0ac5796ae128edd83 /clang/test/SemaCXX/default2.cpp | |
parent | 3cbdeba61aa2c231cb285be03f81534fa699033c (diff) | |
download | bcm5719-llvm-fa0a1f531f7d31ef90419c2ef36bfa0060a73b2c.tar.gz bcm5719-llvm-fa0a1f531f7d31ef90419c2ef36bfa0060a73b2c.zip |
Improve diagnostics for invalid use of non-static members / this:
* s/nonstatic/non-static/ in the diagnostics, since the latter form outvoted
the former by 28-2 in our diagnostics.
* Fix the "use of member in static member function" diagnostic to correctly
detect this situation inside a block or lambda.
* Produce a more specific "invalid use of non-static member" diagnostic for
the case where a nested class member refers to a member of a
lexically-surrounding class.
llvm-svn: 154073
Diffstat (limited to 'clang/test/SemaCXX/default2.cpp')
-rw-r--r-- | clang/test/SemaCXX/default2.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/clang/test/SemaCXX/default2.cpp b/clang/test/SemaCXX/default2.cpp index 20763229cfd..16260449d4b 100644 --- a/clang/test/SemaCXX/default2.cpp +++ b/clang/test/SemaCXX/default2.cpp @@ -28,7 +28,7 @@ void g(int x, int y = x); // expected-error {{default argument references parame void g2(int x, int y, int z = x + y); // expected-error {{default argument references parameter 'x'}} expected-error {{default argument references parameter 'y'}} class X { - void f(X* x = this); // expected-error{{invalid use of 'this' outside of a nonstatic member function}} + void f(X* x = this); // expected-error{{invalid use of 'this' outside of a non-static member function}} void g() { int f(X* x = this); // expected-error{{default argument references 'this'}} @@ -55,7 +55,7 @@ void C::h() { // C++ [dcl.fct.default]p9 struct Y { int a; - int mem1(int i = a); // expected-error{{invalid use of nonstatic data member 'a'}} + int mem1(int i = a); // expected-error{{invalid use of non-static data member 'a'}} int mem2(int i = b); // OK; use Y::b int mem3(int i); int mem4(int i); @@ -64,8 +64,8 @@ struct Y { int mem5(int i = b, // OK; use Y::b int j = c, // OK; use Y::Nested::c int k = j, // expected-error{{default argument references parameter 'j'}} - int l = a, // expected-error{{invalid use of nonstatic data member 'a'}} - Nested* self = this, // expected-error{{invalid use of 'this' outside of a nonstatic member function}} + int l = a, // expected-error{{invalid use of non-static data member 'a'}} + Nested* self = this, // expected-error{{invalid use of 'this' outside of a non-static member function}} int m); // expected-error{{missing default argument on parameter 'm'}} static int c; Nested(int i = 42); @@ -78,7 +78,7 @@ struct Y { int Y::mem3(int i = b) { return i; } // OK; use X::b -int Y::mem4(int i = a) // expected-error{{invalid use of nonstatic data member 'a'}} +int Y::mem4(int i = a) // expected-error{{invalid use of non-static data member 'a'}} { return i; } |