slycelote / caide-cpp-inliner

Transform a C++ program consisting of multiple source files and headers into a single self-contained source file without any external dependencies (except for standard system headers). Unused code is not included in the resulting file.
Other
32 stars 12 forks source link

Unused fields are not removed #10

Closed Predelnik closed 6 years ago

Predelnik commented 7 years ago

Header:

#pragma once
struct C { using type = int; };
struct D { C::type v; };

And use only class D in actual code.

That's very simplified example but obviously it leads to inability to use any sort of your own type trait in library code.

slycelote commented 7 years ago

Does it only happen if the field v is unused?

Predelnik commented 7 years ago

Yeah it looks like assigning to v explicitly makes it work fine. Should this still work even if v is unused though because it doesn't get removed anyway?

slycelote commented 6 years ago

This should be fixed now. (Although some unused fields still don't get removed, at least it won't cause compilation failure.)