Comment #1 on issue 958 by iwansmith: iwyu removes necessary header files when forward declaring template function
https://github.com/include-what-you-use/include-what-you-use/issues/958
My bad, the example doesn't work. Here's a more complete example I've verified fails to compile:
file1.h
```
struct X{
int x = 42;
};
```
file2.h
```
template<typename T>
int templFunc(T);
```
file2.cxx
```
#include "file2.h"
#include "file1.h"
template<typename T>
int templFunc(T val) { return val.x;}
template
int templFunc<X>(X val);
```
[iwans@home ~/Projects/C++]$ include-what-you-use file2.cxx
(file2.h has correct #includes/fwd-decls)
file2.cxx should add these lines:
file2.cxx should remove these lines:
- #include "file1.h" // lines 2-2
The full include-list for file2.cxx:
#include "file2.h"
---
After removing #include "file1.h"
```
[iwans@home ~/Projects/C++]$ g++ -c -fPIC file2.cxx
file2.cxx:7:15: error: 'X' was not declared in this scope
int templFunc<X>(X val);
^
```