Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions clang/include/clang/Basic/DiagnosticSemaKinds.td
Original file line number Diff line number Diff line change
Expand Up @@ -1728,9 +1728,9 @@ def err_introducing_special_friend : Error<
def err_tagless_friend_type_template : Error<
"friend type templates must use an elaborated type">;
def err_no_matching_local_friend : Error<
"no matching function found in local scope">;
"cannot define friend function in a local class definition">;
def err_no_matching_local_friend_suggest : Error<
"no matching function %0 found in local scope; did you mean %3?">;
"cannot define friend function %0 in a local class definition; did you mean %3?">;
def err_partial_specialization_friend : Error<
"partial specialization cannot be declared as a friend">;
def err_qualified_friend_def : Error<
Expand Down
18 changes: 9 additions & 9 deletions clang/test/CXX/class.access/class.friend/p11.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ namespace test0 {
namespace test1 {
void foo() {
class A {
friend void bar(); // expected-error {{no matching function found in local scope}}
friend void bar(); // expected-error {{cannot define friend function in a local class definition}}
};
}
}
Expand All @@ -22,7 +22,7 @@ namespace test2 {

void foo() { // expected-note 2{{'::test2::foo' declared here}}
struct S1 {
friend void foo(); // expected-error {{no matching function 'foo' found in local scope; did you mean '::test2::foo'?}}
friend void foo(); // expected-error {{cannot define friend function 'foo' in a local class definition; did you mean '::test2::foo'?}}
};

void foo(); // expected-note {{local declaration nearly matches}}
Expand All @@ -32,24 +32,24 @@ namespace test2 {

{
struct S2 {
friend void foo(); // expected-error {{no matching function found in local scope}}
friend void foo(); // expected-error {{cannot define friend function in a local class definition}}
};
}

{
int foo;
struct S3 {
friend void foo(); // expected-error {{no matching function 'foo' found in local scope; did you mean '::test2::foo'?}}
friend void foo(); // expected-error {{cannot define friend function 'foo' in a local class definition; did you mean '::test2::foo'?}}
};
}

struct S4 {
friend void bar(); // expected-error {{no matching function 'bar' found in local scope; did you mean '::test2::bar'?}}
friend void bar(); // expected-error {{cannot define friend function 'bar' in a local class definition; did you mean '::test2::bar'?}}
};

{ void bar(); }
struct S5 {
friend void bar(); // expected-error {{no matching function 'bar' found in local scope; did you mean '::test2::bar'?}}
friend void bar(); // expected-error {{cannot define friend function 'bar' in a local class definition; did you mean '::test2::bar'?}}
};

{
Expand All @@ -76,16 +76,16 @@ namespace test2 {

struct S9 {
struct Inner {
friend void baz(); // expected-error {{no matching function 'baz' found in local scope; did you mean 'bar'?}}
friend void baz(); // expected-error {{cannot define friend function 'baz' in a local class definition; did you mean 'bar'?}}
};
};

struct S10 {
void quux() {}
void foo() {
struct Inner1 {
friend void bar(); // expected-error {{no matching function 'bar' found in local scope; did you mean '::test2::bar'?}}
friend void quux(); // expected-error {{no matching function found in local scope}}
friend void bar(); // expected-error {{cannot define friend function 'bar' in a local class definition; did you mean '::test2::bar'?}}
friend void quux(); // expected-error {{cannot define friend function in a local class definition}}
};

void bar();
Expand Down
2 changes: 1 addition & 1 deletion clang/test/SemaCXX/function-redecl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ namespace test0 {
void dummy() {
void Bar(); // expected-note {{'Bar' declared here}}
class A {
friend void bar(); // expected-error {{no matching function 'bar' found in local scope; did you mean 'Bar'}}
friend void bar(); // expected-error {{cannot define friend function 'bar' in a local class definition; did you mean 'Bar'}}
};
}
}
Expand Down
Loading