[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
================
@@ -0,0 +1,10 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+void f(void) {
+ int_val2 = 0; // expected-error{{use of undeclared identifier}}
+ sin(0); // expected-error{{use of undeclared identifier 'sin'}} \
+ // expected-note{{perhaps `#include <cmath>` is needed?}}
+
+ std::cout << "Hello world\n"; // expected-error{{use of undeclared identifier 'std'}} \
+ // expected-note{{perhaps `#include <iostream>` is needed?}}
----------------
Endilll wrote:
This note sounds like `<iostream>` provides `std`, which doesn't feel right.
https://github.com/llvm/llvm-project/pull/140247
More information about the cfe-commits
mailing list