[clang] [Clang] Emit a diagnostic note at the class declaration when the method definition does not match any declaration. (PR #110638)

Vlad Serebrennikov via cfe-commits cfe-commits at lists.llvm.org
Wed Oct 2 02:20:06 PDT 2024


================
@@ -1009,18 +1012,20 @@ namespace cwg355 { struct ::cwg355_S s; }
 // cwg356: na
 
 namespace cwg357 { // cwg357: yes
-  template<typename T> struct A {
+  template<typename T> struct A { // #defined-here-cwg357-A
     void f() const; // #cwg357-f
   };
   template<typename T> void A<T>::f() {}
   // expected-error at -1 {{out-of-line definition of 'f' does not match any declaration in 'A<T>'}}
-  //   expected-note@#cwg357-f {{member declaration does not match because it is const qualified}}
+  // expected-note@#defined-here-cwg357-A {{defined here}}
+  // expected-note@#cwg357-f {{member declaration does not match because it is const qualified}}
 
-  struct B {
+  struct B { // #defined-here-cwg357-B
----------------
Endilll wrote:

```suggestion
  struct B { // #cwg357-B
```

https://github.com/llvm/llvm-project/pull/110638


More information about the cfe-commits mailing list