Based on the instance
name, it looks like factory
might be a singleton, and instance
is a static function. In that case, the value of factory
is indeed never used, and you can instead call the function directly on the class, which is essentially what the compiler does anyway:
Factory::instance().Register(...);
Then you can remove the parameter entirely, and you'll avoid the apparent compiler bug that conflates usage of the parameter with usage of the parameter's value.