user23887: In this talkchess thread, they discuss trapped rooks and castling rights. In post #5, user @Lyudmil Tsvetkov posted:

I would give at least some 10-15cps for temporary prevention of castling.

Here is how StockFish implements it:
score -= TrappedRook * (1 + !pos.castling_rights(Us));

Here an example position.
r3kb1r/pp3ppp/4bn2/3p4/P7/4N1P1/1P2PPBP/R1B1K2R w Kq - 0 1

When searching, the move Bg2-f1 leads to the position.
r3kb1r/pp3ppp/4bn2/3p4/P7/4N1P1/1P2PP1P/R1B1KB1R b Kq - 1 1

As you can see, the White bishop has blocked castling, but pos.castling_rights(Us) for White still returns true, which means Stockfish is not penalizing for the temporary prevention of castling.
Is it intentional or is it a Stockfish bug?

user9025: White hasn't lost his castling rights. It's just not a legal move right now. There is a distinction.
White would still be able to castle king-side, if the bishop were to move.

23887: <p>In <a href="http://www.talkchess.com/forum3/viewtopic.php?p=575819&amp;sid=604f7301762ea0d2f4cb746657e2a379#p575819" rel="nofollow noreferrer">this talkchess thread</a>, they discuss trapped rooks and castling rights. In post #5, user @Lyudmil Tsvetkov posted:</p>
<blockquote>
<p>I would give at least some 10-15cps for temporary prevention of castling.</p>
</blockquote>
<p>Here is <a href="https://github.com/official-stockfish/Stockfish/blob/995ee4b31105ad8c7976cc68c11fabfdc5108e63/src/evaluate.cpp#L366" rel="nofollow noreferrer">how</a> StockFish implements it:</p>
<pre><code>score -= TrappedRook * (1 + !pos.castling_rights(Us));
</code></pre>
<p>Here an example position.</p>
<pre><code>r3kb1r/pp3ppp/4bn2/3p4/P7/4N1P1/1P2PPBP/R1B1K2R w Kq - 0 1
</code></pre>
<p>When searching, the move Bg2-f1 leads to the position.</p>
<pre><code>r3kb1r/pp3ppp/4bn2/3p4/P7/4N1P1/1P2PP1P/R1B1KB1R b Kq - 1 1
</code></pre>
<p>As you can see, the White bishop has blocked castling, but <code>pos.castling_rights(Us)</code> for White still returns true, which means Stockfish is not penalizing for the temporary prevention of castling.</p>
<p>Is it intentional or is it a Stockfish bug?</p>
 9025: <p>White hasn't lost his castling rights. It's just not a legal move right now. There is a distinction.</p>
<p>White would still be able to castle king-side, if the bishop were to move.</p>
