Skip to content

Commit 61f1dc0

Browse files
authored
Added more descriptive message (issue 116808) (#117201)
The dialogue messages were changed to be more descriptive. Fixes #116808
1 parent 39913ae commit 61f1dc0

File tree

3 files changed

+12
-12
lines changed

3 files changed

+12
-12
lines changed

clang/include/clang/Basic/DiagnosticSemaKinds.td

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1728,9 +1728,9 @@ def err_introducing_special_friend : Error<
17281728
def err_tagless_friend_type_template : Error<
17291729
"friend type templates must use an elaborated type">;
17301730
def err_no_matching_local_friend : Error<
1731-
"no matching function found in local scope">;
1731+
"cannot define friend function in a local class definition">;
17321732
def err_no_matching_local_friend_suggest : Error<
1733-
"no matching function %0 found in local scope; did you mean %3?">;
1733+
"cannot define friend function %0 in a local class definition; did you mean %3?">;
17341734
def err_partial_specialization_friend : Error<
17351735
"partial specialization cannot be declared as a friend">;
17361736
def err_qualified_friend_def : Error<

clang/test/CXX/class.access/class.friend/p11.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ namespace test0 {
1212
namespace test1 {
1313
void foo() {
1414
class A {
15-
friend void bar(); // expected-error {{no matching function found in local scope}}
15+
friend void bar(); // expected-error {{cannot define friend function in a local class definition}}
1616
};
1717
}
1818
}
@@ -22,7 +22,7 @@ namespace test2 {
2222

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

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

3333
{
3434
struct S2 {
35-
friend void foo(); // expected-error {{no matching function found in local scope}}
35+
friend void foo(); // expected-error {{cannot define friend function in a local class definition}}
3636
};
3737
}
3838

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

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

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

5555
{
@@ -76,16 +76,16 @@ namespace test2 {
7676

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

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

9191
void bar();

clang/test/SemaCXX/function-redecl.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ namespace test0 {
4646
void dummy() {
4747
void Bar(); // expected-note {{'Bar' declared here}}
4848
class A {
49-
friend void bar(); // expected-error {{no matching function 'bar' found in local scope; did you mean 'Bar'}}
49+
friend void bar(); // expected-error {{cannot define friend function 'bar' in a local class definition; did you mean 'Bar'}}
5050
};
5151
}
5252
}

0 commit comments

Comments
 (0)