My university tests every student. So they have the data. I can understand that for privacy, the names of the students who tested positive are not released to the public or the instructors. But do instructors have right to know how many or if any student in his/her class tested positive?
In the university I work for that would make no difference: everybody physically present is tested negative, as those who are tested positive are not allowed to enter the building, and this is checked.
The bigger problem I see with giving this information to lecturers is with smaller courses. It would be very likely that anonymity can no longer be guaranteed. Moreover, there is no clear cutoff point that distinguishes between small and big courses. So I understand the universities that do not give that information.
Instructors have a right to a safe work environment, like any employees, and that right will be enshrined in legislation in most countries. So, if you can successfully argue that withholding information about students testing positive puts the instructor in danger to their health and therefore violates that right, the answer to your question would be “yes”.
However, this situation you are asking about is so new that I doubt any legislation or case law exist anywhere that are specific enough to make it possible to predict whether such an argument can work. So, on a practical level the more realistic answer at this point in time is “no one knows”.