https://bugs.llvm.org/show_bug.cgi?id=51214

            Bug ID: 51214
           Summary: suggest including stdbool.h in C mode when missing
                    definition of true/false, etc.
           Product: new-bugs
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: new bugs
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected]

(From https://twitter.com/hansw2000/status/1419275810163331074)

Consider:

$ cat /tmp/a.c
#include <stdlib.h>

int foo();

int main() {
  while (true) { if (foo() == 42) break; }
}

$ clang -c /tmp/a.c
/tmp/a.c:6:10: error: use of undeclared identifier 'true'; did you mean 'free'?
  while (true) { if (foo() == 42) break; }
         ^~~~
         free
/usr/include/stdlib.h:565:13: note: 'free' declared here
extern void free (void *__ptr) __THROW;
            ^
1 error generated.


The "did you mean 'free'" hint is amusing, but it would be more helpful if
clang suggested including stdbool.h here, like it does with many standard
library functions.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to