catchorg / Catch2

A modern, C++-native, test framework for unit-tests, TDD and BDD - using C++14, C++17 and later (C++11 support is in v2.x branch, and C++03 on the Catch1.x branch)
https://discord.gg/4CWS9zD
Boost Software License 1.0
18.22k stars 3.01k forks source link

How does (can) auto-registration work? #2872

Open dabrahams opened 1 month ago

dabrahams commented 1 month ago

Sorry to use an issue for this, but I don't know how else to ask. How can tests be self-registering? Isn't the compiler allowed to dead-strip those AutoReg instances? Maybe it just happens to work on all shipping compilers?

Thanks for indulging this misplaced question, Dave