================ @@ -179,18 +179,20 @@ static_assert(false, Message{}); // expected-error {{static assertion failed: He } struct MessageInvalidSize { - constexpr auto size(int) const; // expected-note {{candidate function not viable: requires 1 argument, but 0 were provided}} - constexpr auto data() const; + constexpr unsigned long size(int) const; // expected-note {{'size' declared here}} + constexpr const char* data() const; }; struct MessageInvalidData { - constexpr auto size() const; - constexpr auto data(int) const; // expected-note {{candidate function not viable: requires 1 argument, but 0 were provided}} + constexpr unsigned long size() const; + constexpr const char* data(int) const; // expected-note {{'data' declared here}} }; static_assert(false, MessageInvalidSize{}); // expected-error {{static assertion failed}} \ - // expected-error {{the message in a static assertion must have a 'size()' member function returning an object convertible to 'std::size_t'}} + // expected-error {{the message in a static assertion must have a 'size()' member function returning an object convertible to 'std::size_t'}} \ ---------------- AaronBallman wrote:
The diagnostic is actually slightly worse than it was before -- this *does* have a `size()` member function that returns an object convertible to `std::size_t`, the issue is that it's not viable to call because it has required parameters. The previous notes were a bit better at showing this because some users use `()` to mean "this is the name of a function not a variable" in prose and not "this is a function call accepting no arguments" -- e.g., `memcpy()` vs `errno` Same issue applies to the `data()` diagnostic below. Can we do anything about this (without a ton of effort)? https://github.com/llvm/llvm-project/pull/73234 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits