diff options
author | Kaelyn Uhrain <rikka@google.com> | 2011-10-10 18:01:37 +0000 |
---|---|---|
committer | Kaelyn Uhrain <rikka@google.com> | 2011-10-10 18:01:37 +0000 |
commit | 1a6eb99d45e554ea5431d49c5cbcab4fc3d9f70e (patch) | |
tree | d89d48c4f477cadc4f51a8bf433ce1959ff3dc5e /clang/test/SemaCXX/function-redecl.cpp | |
parent | 7571ba7015d18d715f686f8a4163c1ef412694a5 (diff) | |
download | bcm5719-llvm-1a6eb99d45e554ea5431d49c5cbcab4fc3d9f70e.tar.gz bcm5719-llvm-1a6eb99d45e554ea5431d49c5cbcab4fc3d9f70e.zip |
Give nicer note when a member redeclaration has or lacks 'const'
llvm-svn: 141555
Diffstat (limited to 'clang/test/SemaCXX/function-redecl.cpp')
-rw-r--r-- | clang/test/SemaCXX/function-redecl.cpp | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/clang/test/SemaCXX/function-redecl.cpp b/clang/test/SemaCXX/function-redecl.cpp index 2bc04a6d077..b19bff65430 100644 --- a/clang/test/SemaCXX/function-redecl.cpp +++ b/clang/test/SemaCXX/function-redecl.cpp @@ -62,7 +62,7 @@ struct Foo { } class Bar { - void f(test1::Foo::Inner foo) const; // expected-note {{member declaration nearly matches}} + void f(test1::Foo::Inner foo) const; // expected-note {{member declaration does not match because it is const qualified}} }; using test1::Foo; @@ -79,3 +79,16 @@ class Crash { void Crash::cart(int count) const {} // expected-error {{out-of-line definition of 'cart' does not match any declaration in 'Crash'}} // ...while this one crashed clang void Crash::chart(int count) const {} // expected-error {{out-of-line definition of 'chart' does not match any declaration in 'Crash'}} + +class TestConst { + public: + int getit() const; // expected-note {{member declaration does not match because it is const qualified}} + void setit(int); // expected-note {{member declaration does not match because it is not const qualified}} +}; + +int TestConst::getit() { // expected-error {{out-of-line definition of 'getit' does not match any declaration in 'TestConst'}} + return 1; +} + +void TestConst::setit(int) const { // expected-error {{out-of-line definition of 'setit' does not match any declaration in 'TestConst'}} +} |