CMakePP / CMakePPLang

Object-oriented extension to the CMake language.
http://cmakepp.github.io/CMakePPLang/
Apache License 2.0
11 stars 4 forks source link

Vague exception thrown when redefining classes in debug mode #110

Open AutonomicPerfectionist opened 1 year ago

AutonomicPerfectionist commented 1 year ago

Describe the bug I discovered that some tests do not enable debug mode for the entire test; they only set it in one subsection, which is not preserved in any tests or sections above it. An example is here:

https://github.com/CMakePP/CMakePPLang/blob/4427a5218e9775dc364b728abd9ab15fd92f87c6/tests/class/class.cmake#L10

Upon enabling it for the entire test, I discovered that multiple tests started failing because they were redefining classes, but the exception was a type error in the signature of the cpp_decl() function:

Assertion: class is convertible to desc failed.
CMakePPLang/cmake/cmakepp_lang/class/class_decl.cmake:63 (cpp_assert_signature)

It appears that since the class is defined, the type of MyClass changes from desc to class, which fails the signature check. Might be a good idea to explicitly disallow redefining classes, or if it's desired to change the type in the signature to str