Undeclared identifier LinearToSRGB when color mode is HDR when target is Custom Render Texture

If I change the Mode to Default, error disappears.

Logged bug report IN-88801.

This may be related to similar errors in
Unity Issue Tracker - Compute Shader compilation error is thrown when importing HDRP

In can repro in U2022.3 LTS (HDRP 14.0.10) and U6000.0.22 (HDRP 17.0.3).