Closed phaedon closed 10 months ago
To figure out if code successfully compiles, we would have to implement a compiler. We are not going to do that. That job is best left to an actual compiler. GoogleTest is designed to test runtime bugs.
Some ways you could do this:
Does the feature exist in the most recent commit?
No
Why do we need this feature?
Modern idioms for C++ library design often rely on compile-time invariants (static_assert, constexpr, enable_if, etc) It is useful to be able to write unit tests which can run and successfully verify compilation failures.
Describe the proposal.
I don't have a detailed design, however I have previously seen (and personally used) something along these lines.
And then test output would be successful on the basis of the compilation failure triggered by the static assert.
Is the feature specific to an operating system, compiler, or build system version?
No