Create test type for compiling or failing to compile
wawiesel opened this issue · 1 comments
wawiesel commented
This is difficult but a very nice capability.
In C++, it is desirable to verify in unit tests that certain situations lead to a compiler error, e.g.
- CTOR is private (direct construction not allowed)
- assignment not permitted
- copy CTOR disabled
- etc.
The best way to do this seems to me to create a CMake test that tests the compiler itself.
t123TestCompiler( <filename> POSITIVE )
t123TestCompiler( <filename> NEGATIVE )
One of the tricky parts is different compilers giving different error messages. Perhaps a line number match is enough?
wawiesel commented
Now available.