On an indictment for felony the jury may find the accused not guilty of the felony but guilty of an attempt to commit such felony, or of being an accessory thereto; and a general verdict of not guilty, upon such indictment, shall be a bar to a subsequent prosecution for an attempt to commit such felony, or of being an accessory thereto.
Code 1950, § 19.1-254; 1960, c. 366; 1975, c. 495.