{
NonAtomicBlock< Atomic_Force > a_NoBlock;
// protected code goes here
// destructor has to be called here or very bad things happen
}
You rely on the fact that the descructor is called precisely at the end of scope. What happens if the optimizer realizes a_NoBlock is not used and invokes the destructor early?