Author: tlemy Date: 2024-11-22T12:24:17-05:00 New Revision: 61f1dc05a88de38afcb337ef194cfdb7dc798197
URL: https://github.com/llvm/llvm-project/commit/61f1dc05a88de38afcb337ef194cfdb7dc798197 DIFF: https://github.com/llvm/llvm-project/commit/61f1dc05a88de38afcb337ef194cfdb7dc798197.diff LOG: Added more descriptive message (issue 116808) (#117201) The dialogue messages were changed to be more descriptive. Fixes #116808 Added: Modified: clang/include/clang/Basic/DiagnosticSemaKinds.td clang/test/CXX/class.access/class.friend/p11.cpp clang/test/SemaCXX/function-redecl.cpp Removed: ################################################################################ diff --git a/clang/include/clang/Basic/DiagnosticSemaKinds.td b/clang/include/clang/Basic/DiagnosticSemaKinds.td index 157d77b38b354e..eb05a6a77978af 100644 --- a/clang/include/clang/Basic/DiagnosticSemaKinds.td +++ b/clang/include/clang/Basic/DiagnosticSemaKinds.td @@ -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< diff --git a/clang/test/CXX/class.access/class.friend/p11.cpp b/clang/test/CXX/class.access/class.friend/p11.cpp index 71f11bdf9e0736..bc2bc073f51a73 100644 --- a/clang/test/CXX/class.access/class.friend/p11.cpp +++ b/clang/test/CXX/class.access/class.friend/p11.cpp @@ -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}} }; } } @@ -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}} @@ -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'?}} }; { @@ -76,7 +76,7 @@ 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'?}} }; }; @@ -84,8 +84,8 @@ namespace test2 { 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(); diff --git a/clang/test/SemaCXX/function-redecl.cpp b/clang/test/SemaCXX/function-redecl.cpp index 8c0e9a880d070e..90490a4c1b7005 100644 --- a/clang/test/SemaCXX/function-redecl.cpp +++ b/clang/test/SemaCXX/function-redecl.cpp @@ -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'}} }; } } _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits