Issue 141504
Summary Should diagnose discard of Objective-C++ method returning nodiscard type
Labels new issue
Assignees
Reporter halbi2
    ```
struct [[nodiscard("Expected")]] expected {};

struct A {
  expected f();
};
@interface B
  -(expected) f;
@end

void test(A* a, B* b) {
  a->f();  // warn
  [b f];  // no warn
}
```
Clang 20 correctly diagnoses the discarded result in `a->f()` but erroneously does not diagnose the discarded result in `[b f]`.

https://godbolt.org/z/Gvx94Kcja
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to