fix Issue 10768 - DMD does not show deprecation message for missing 'override' keyword

If a class/struct/template is not speculatively instantiated, error gagging should be ungagged temporarily during its semantic.
Use RAII idiom to do it reliably.