Comment #5 on issue 1115 by bolshakov-a: IWYU pragma: export not effective for forward declared enum class
https://github.com/include-what-you-use/include-what-you-use/issues/1115
Yes, it seems that IWYU don't have an option to export something but `#include`s at now. @justusranvier, the problem is mainly with source files or header files? [I have an idea](
https://github.com/include-what-you-use/include-what-you-use/pull/675#issuecomment-1236344461) that forward declarations should not appear in source files at all. Maybe, it could be done though command line switch in order not to break tests...
> It's not like forward declaring a regular class where you're only making the name available - the forward declarations include the underlying type, which raises the possibility that it might get changed in one place and now all the forward declarations are wrong.
But you can forward-declare a regular class, then make it `struct` (or, likely, vice versa) and also have to change all the forward declarations. Or just change its name... My opinion is that the cases when one changes an underlying type are much less frequent as the cases when one adds a new enum item and recompiles many files which could not be recompiled. Maybe, IWYU didn't always report full enum type usages earlier, but there were inconsistencies with it.
I aggree that enum forward declarations could theoretically cause a problem: there are very specific cases when it is possible to link together files with different underlying types of single enum and to get a runtime crash. And I thought to make a command-line flag for this feature. But I think that the benefit outweights possible harm...