New issue 971 by osandov: Export a forward declaration (e.g., for an opaque type)?
https://github.com/include-what-you-use/include-what-you-use/issues/971
Let's say the public header `public.h` for my library defines some interfaces, including an opaque pointer type:
```c
struct opaque;
struct opaque *create_opaque(void);
enum my_enum {
FOO,
BAR,
BAZ,
};
```
And I have an internal header that uses those interfaces:
```c
#include "public.h"
void use_opaque(struct opaque *);
void use_enum(enum my_enum);
```
Ideally, IWYU would realize that `public.h` "exports" a declaration of `struct opaque`, so "private.h" doesn't need a forward declaration. However, this is not the case:
```console
$ include-what-you-use private.h
private.h should add these lines:
struct opaque;
private.h should remove these lines:
The full include-list for private.h:
#include "public.h" // for my_enum
struct opaque;
---
```
Is there any way to avoid this? The declaration of `struct opaque` really is a part of the interface provided by `public.h`, so requiring forward declarations seems silly.