In any trial or examination in or before any court or officer for a felony or misdemeanor, the accused shall, with his consent (but not otherwise) be a competent witness on such trial or examination; and if he so voluntarily becomes a witness he shall, as to all matters relevant to the issue, be deemed to have waived his privilege of not giving evidence against himself and shall be subject to cross-examination as any other witness; but his failure to testify shall create no presumption against him nor be the subject of any comment before the court or jury by anyone.