"All I can do is to call the police". Is this perfect English?

I just took a grammar test which claims that, although it might be neater without the “to”, as it stands the sentence in the title is grammatically perfect English.

Is it really? It certainly feels wrong.

Grammatically it’s no different from saying:

To err is human.”

or

It’s better to have loved and lost than never to have loved at all.”

Do those sound wrong to you, too?

I think it’s one of those ones which is, strictly speaking, grammatically correct, but which grates on the ear of most English-speaking people.

Leaving the ‘to’ out makes it sound much more like something somebody would actually say to me.

The way that doesn’t “grate” on the ear, though, is harder to explain by conventional grammar. Would you say this?:

*What I need is call the police.

It sounds more formal with the “to,” but is grammatically correct. If I were talking about calling the police, I agree, I would likely be a little less formal.

I think it’s not just less formal, but correct because it’s a kind of parallel construction. Modals like can, will, must, etc. aren’t formed with infinitives (to call the police), but with base forms (call the police). So the can in “all I can do” can take a base form verb phrase:
*I can address the problem later. Or (I can) call the police.

I need to address the problem later. Or (I need) to call the police.*

I think the reason it sounds wrong to me is because, in my head, the “I” at the start of the sentence has already provided the person for the verb later on in the sentence, “I … call the police”. So instinctively it sounds like it’s incorrect to then treat the verb later on as if it’s still an infinitive. You’d never say “I to call the police”.

But I suppose “call the police” really is still an infinite in this sentence?

“All I can do is to call the police” sounds weird.

“The only thing I can do is to call the police” sounds better to me, somehow.

Not to me: both those sentences are better without “to”.

Grammar should describe what sounds right to native speakers. If a grammatical rule says that something that sounds wrong (to most native speakers) is actually right (or vice-versa), then the rule is wrong.

I would drop the “to” in the OP’s sentence. But I would say, “I need you to call the police.”

Your earlier example was better at demonstrating the difference with the modal. This one fails because “I need to -” is just as valid as “I need -”. In fact, I think “Or to call the police” sounds fairly stilted unless that was the intention.

Well, just to show how one could construe a “deep structure” where the infinitive is called for in one way or another.

IANA grammar expert, but I am a native speaker of American.

To me the OP’s example smells a bit archaic. In 1900 that would have been considered 100% gramatically correct. Nowadays using the 'to" in the middle sounds stilted.

“What am I to do?” is what my grandmother would have said. “What will I do?” is what I would say in the same circumstance. Not quite the same grammatical situation, but close.

I also wonder if the British / Commonwealth version of the language would be more inclined to consider the “to” correct.

I think those two examples are different in meaning. They would not be used in the same circumstances to mean the same thing, either now or in your grandmother’s time. Both are grammatically correct, but "What am I to do? is equivalent to "“What should I do?” not “What will I do?”

I am British, and the to (in the original example) sounds wrong to me.

I am British English, and the example sounds right to me, I hear variations of it frequently.

If I heard the original sentence I would automatically guess that english was not their first language.