"A man enters the dark bedroom of an unmarried woman after seeing her boyfriend leave late at night, and has sexual intercourse with the woman while pretending to be the boyfriend. Has the man committed rape? Because of historical anomalies in the law and the statutory definition of rape, the answer is no, even though, if the woman had been married and the man had impersonated her husband, the answer would be yes."
People v. Morales, 2013 Cal. App. LEXIS 2 (Cal. App. 2d Dist. Jan. 2, 2013)
Isn't this a plot device from Shakespeare's Measure for Measure?