[clang] [Clang] suggest headers on undeclared errors (#120388) (PR #140247)
Vlad Serebrennikov via cfe-commits
cfe-commits at lists.llvm.org
Fri May 16 06:03:15 PDT 2025
================
@@ -26,14 +26,18 @@ void no_get_1() {
auto [a0, a1] = A(); // expected-error {{decomposes into 3 elements}}
auto [b0, b1] = B(); // expected-error {{decomposes into 3 elements}}
}
- auto [a0, a1, a2] = A(); // expected-error {{undeclared identifier 'get'}} expected-note {{in implicit initialization of binding declaration 'a0'}}
+ auto [a0, a1, a2] = A(); // expected-error {{undeclared identifier 'get'}} \
+ // expected-note {{perhaps `#include <ranges>` is needed?}} \
----------------
Endilll wrote:
`<ranges>` is far from the only header that provides overloads of `std::get`, but probably the heaviest one for compile times. Also, this code is run in C++17 mode, and there's no `<ranges>` header in C++17.
https://github.com/llvm/llvm-project/pull/140247
More information about the cfe-commits
mailing list