| Issue |
174715
|
| Summary |
[clang-tidy] misc-include-cleaner deletes inclusion necessary for explicit instantiation
|
| Labels |
clang-tidy
|
| Assignees |
|
| Reporter |
user202729
|
Consider the following
```
[tmp2]$ cat a.h
#pragma once
struct AA
{
};
[tmp2]$ cat b.h
#pragma once
template <class T>
void f();
[tmp2]$ cat b.hpp
#pragma once
#include "b.h" // IWYU pragma: export
template <class T>
void f()
{
}
[tmp2]$ cat a.cpp
#include "a.h"
#include "b.hpp"
template void f<AA>();
```
when I run `clang-tidy --checks='*' a.cpp`, I get
```
/tmp/tmp2/a.cpp:2:1: warning: included header b.hpp is not used directly [misc-include-cleaner]
2 | #include "b.hpp"
| ^~~~~~~~~~~~~~~~
3 |
```
even though deleting that inclusion makes the code no longer compile.
Version:
```
LLVM (http://llvm.org/):
LLVM version 21.1.8
Optimized build.
```
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs