The answer depends on where the pass happens. Passing is prohibited at the railroad crossing itself and within 100 m before it. Before a crossing you may need to stop suddenly — because of a train, the gate or a line of vehicles — and a vehicle in the oncoming lane at that moment is a danger