diff options
author | Douglas Gregor <dgregor@apple.com> | 2009-02-06 17:46:57 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2009-02-06 17:46:57 +0000 |
commit | 8af63e42e3fea588e4899e3344d3ec0a48fd2b07 (patch) | |
tree | ca13be3f09aa29a41708d9e62a3394d1dea750aa /clang/test/SemaCXX/nested-name-spec.cpp | |
parent | 066757eea1ee1ed24642bcc7018e54deba17a116 (diff) | |
download | bcm5719-llvm-8af63e42e3fea588e4899e3344d3ec0a48fd2b07.tar.gz bcm5719-llvm-8af63e42e3fea588e4899e3344d3ec0a48fd2b07.zip |
Diagnose attempts to define a namespace member out-of-line when no
matching member exists. Thanks to Piotr Rak for reporting the problem!
llvm-svn: 63939
Diffstat (limited to 'clang/test/SemaCXX/nested-name-spec.cpp')
-rw-r--r-- | clang/test/SemaCXX/nested-name-spec.cpp | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/clang/test/SemaCXX/nested-name-spec.cpp b/clang/test/SemaCXX/nested-name-spec.cpp index b48207345a5..0c160075bf3 100644 --- a/clang/test/SemaCXX/nested-name-spec.cpp +++ b/clang/test/SemaCXX/nested-name-spec.cpp @@ -123,3 +123,28 @@ Operators Operators::operator+(const Operators&) const { Operators::operator bool() { return true; } + +namespace A { + void g(int&); // expected-note{{member declaration nearly matches}} +} + +void A::f() {} // expected-error{{out-of-line definition does not match any declaration in 'A'}} + +void A::g(const int&) { } // expected-error{{out-of-line definition does not match any declaration in 'A'}} + +struct Struct { }; + +void Struct::f() { } // expected-error{{out-of-line definition does not match any declaration in 'Struct'}} + +void global_func(int); +void global_func2(int); + +namespace N { + void ::global_func(int) { } // expected-error{{definition or redeclaration of 'global_func' cannot name the global scope}} + + void f(); + // FIXME: if we move this to a separate definition of N, things break! +} +void ::global_func2(int) { } // expected-error{{definition or redeclaration of 'global_func2' cannot name the global scope}} + +void N::f() { } // okay |