summaryrefslogtreecommitdiff
path: root/test/CXX
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2013-08-09 04:35:01 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2013-08-09 04:35:01 +0000
commit4e9686b1f9947f1747b4f4316deb2087a7f56282 (patch)
tree5d4e55e6fb8f6eb45285afb5a101a8b0db4aecfb /test/CXX
parentfa220f58f02014e4a3389f429b82948a09dc4986 (diff)
downloadclang-4e9686b1f9947f1747b4f4316deb2087a7f56282.tar.gz
Implement [class.friend]p11's special name lookup rules for friend declarations
of local classes. We were previously handling this by performing qualified lookup within a function declaration(!!); replace it with the proper scope lookup. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@188050 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CXX')
-rw-r--r--test/CXX/class.access/class.friend/p11.cpp80
-rw-r--r--test/CXX/special/class.copy/implicit-move.cpp36
2 files changed, 98 insertions, 18 deletions
diff --git a/test/CXX/class.access/class.friend/p11.cpp b/test/CXX/class.access/class.friend/p11.cpp
index a05b2d2875..ba44a0d492 100644
--- a/test/CXX/class.access/class.friend/p11.cpp
+++ b/test/CXX/class.access/class.friend/p11.cpp
@@ -17,3 +17,83 @@ namespace test1 {
};
}
}
+
+namespace test2 {
+ void bar(); // expected-note {{'::test2::bar' declared here}}
+
+ void foo() { // expected-note {{'::test2::foo' declared here}}
+ struct S1 {
+ friend void foo(); // expected-error {{no matching function 'foo' found in local scope; did you mean '::test2::foo'?}}
+ };
+
+ void foo(); // expected-note {{local declaration nearly matches}}
+ struct S2 {
+ friend void foo();
+ };
+
+ {
+ struct S2 {
+ friend void foo(); // expected-error {{no matching function found in local scope}}
+ };
+ }
+
+ {
+ int foo;
+ struct S3 {
+ friend void foo(); // expected-error {{no matching function found in local scope}}
+ };
+ }
+
+ struct S4 {
+ friend void bar(); // expected-error {{no matching function 'bar' found in local scope; did you mean '::test2::bar'?}}
+ };
+
+ { void bar(); }
+ struct S5 {
+ friend void bar(); // expected-error {{no matching function found in local scope}}
+ };
+
+ {
+ void bar();
+ struct S6 {
+ friend void bar();
+ };
+ }
+
+ struct S7 {
+ void bar() { Inner::f(); }
+ struct Inner {
+ friend void bar();
+ static void f() {}
+ };
+ };
+
+ void bar(); // expected-note {{'bar' declared here}}
+ struct S8 {
+ struct Inner {
+ friend void bar();
+ };
+ };
+
+ struct S9 {
+ struct Inner {
+ friend void baz(); // expected-error {{no matching function 'baz' found in local scope; did you mean 'bar'?}}
+ };
+ };
+
+ struct S10 {
+ void quux() {}
+ void foo() {
+ struct Inner1 {
+ friend void bar(); // expected-error {{no matching function found in local scope}}
+ friend void quux(); // expected-error {{no matching function found in local scope}}
+ };
+
+ void bar();
+ struct Inner2 {
+ friend void bar();
+ };
+ }
+ };
+ }
+}
diff --git a/test/CXX/special/class.copy/implicit-move.cpp b/test/CXX/special/class.copy/implicit-move.cpp
index 33374129f7..1941da7e8a 100644
--- a/test/CXX/special/class.copy/implicit-move.cpp
+++ b/test/CXX/special/class.copy/implicit-move.cpp
@@ -209,29 +209,29 @@ namespace DR1402 {
struct NoMove11 : NonTrivialMoveAssignVBase {}; // expected-note {{'const DR1402::NoMove11 &'}}
struct Test {
- friend NoMove1::NoMove1(NoMove1 &&); // expected-error {{no matching function}}
- friend NoMove2::NoMove2(NoMove2 &&); // expected-error {{no matching function}}
- friend NoMove3::NoMove3(NoMove3 &&); // expected-error {{no matching function}}
- friend NoMove4::NoMove4(NoMove4 &&); // expected-error {{no matching function}}
- friend NoMove5::NoMove5(NoMove5 &&); // expected-error {{no matching function}}
- friend NoMove6::NoMove6(NoMove6 &&); // expected-error {{no matching function}}
- friend NoMove7::NoMove7(NoMove7 &&); // expected-error {{no matching function}}
- friend NoMove8::NoMove8(NoMove8 &&); // expected-error {{no matching function}}
+ friend NoMove1::NoMove1(NoMove1 &&); // expected-error {{does not match}}
+ friend NoMove2::NoMove2(NoMove2 &&); // expected-error {{does not match}}
+ friend NoMove3::NoMove3(NoMove3 &&); // expected-error {{does not match}}
+ friend NoMove4::NoMove4(NoMove4 &&); // expected-error {{does not match}}
+ friend NoMove5::NoMove5(NoMove5 &&); // expected-error {{does not match}}
+ friend NoMove6::NoMove6(NoMove6 &&); // expected-error {{does not match}}
+ friend NoMove7::NoMove7(NoMove7 &&); // expected-error {{does not match}}
+ friend NoMove8::NoMove8(NoMove8 &&); // expected-error {{does not match}}
friend NoMove9::NoMove9(NoMove9 &&);
friend NoMove10::NoMove10(NoMove10 &&);
friend NoMove11::NoMove11(NoMove11 &&);
- friend NoMove1 &NoMove1::operator=(NoMove1 &&); // expected-error {{no matching function}}
- friend NoMove2 &NoMove2::operator=(NoMove2 &&); // expected-error {{no matching function}}
- friend NoMove3 &NoMove3::operator=(NoMove3 &&); // expected-error {{no matching function}}
- friend NoMove4 &NoMove4::operator=(NoMove4 &&); // expected-error {{no matching function}}
- friend NoMove5 &NoMove5::operator=(NoMove5 &&); // expected-error {{no matching function}}
- friend NoMove6 &NoMove6::operator=(NoMove6 &&); // expected-error {{no matching function}}
- friend NoMove7 &NoMove7::operator=(NoMove7 &&); // expected-error {{no matching function}}
- friend NoMove8 &NoMove8::operator=(NoMove8 &&); // expected-error {{no matching function}}
+ friend NoMove1 &NoMove1::operator=(NoMove1 &&); // expected-error {{does not match}}
+ friend NoMove2 &NoMove2::operator=(NoMove2 &&); // expected-error {{does not match}}
+ friend NoMove3 &NoMove3::operator=(NoMove3 &&); // expected-error {{does not match}}
+ friend NoMove4 &NoMove4::operator=(NoMove4 &&); // expected-error {{does not match}}
+ friend NoMove5 &NoMove5::operator=(NoMove5 &&); // expected-error {{does not match}}
+ friend NoMove6 &NoMove6::operator=(NoMove6 &&); // expected-error {{does not match}}
+ friend NoMove7 &NoMove7::operator=(NoMove7 &&); // expected-error {{does not match}}
+ friend NoMove8 &NoMove8::operator=(NoMove8 &&); // expected-error {{does not match}}
friend NoMove9 &NoMove9::operator=(NoMove9 &&);
- friend NoMove10 &NoMove10::operator=(NoMove10 &&); // expected-error {{no matching function}}
- friend NoMove11 &NoMove11::operator=(NoMove11 &&); // expected-error {{no matching function}}
+ friend NoMove10 &NoMove10::operator=(NoMove10 &&); // expected-error {{does not match}}
+ friend NoMove11 &NoMove11::operator=(NoMove11 &&); // expected-error {{does not match}}
};
}