
162 Cal.App.3d 1147 (1984)
209 Cal. Rptr. 414
THE PEOPLE, Plaintiff and Respondent,
v.
TIMOTHY WAYNE PERRY, Defendant and Appellant.
Docket No. B003576.
Court of Appeals of California, Second District, Division Five.
December 20, 1984.
*1149 COUNSEL
Judith A. Wolfsen, under appointment by the Court of Appeal, for Defendant and Appellant.
John K. Van de Kamp, Attorney General, Norman H. Sokolow and Robert R. Anderson, Deputy Attorneys General, for Plaintiff and Respondent.
OPINION
OSBORNE, J.[*]
On this appeal following a plea of guilty, we conclude that the appeal must be dismissed because appellant has not complied with Penal Code section 1237.5.[1] Even if section 1237.5 were not a bar, appellant's contention is not reviewable after a guilty plea.

FACTS AND CONTENTION
On December 6, 1983, appellant pleaded guilty to robbery, and admitted that in the commission of the offense, he personally used a firearm within *1150 the meaning of sections 12022.5 and 1203.06, subdivision (a)(1). Appellant waived a probation report and requested immediate sentencing. Probation was denied and appellant was ordered imprisoned in state prison for robbery for the midterm of three years, and for an additional two years for the use of a firearm. On January 23, 1984, appellant filed a notice of appeal.
Appellant contends that on December 6, 1983, after discussions with counsel, the court advised appellant that the "use" allegation would apply regardless of whether the gun was operable, so a motion to strike the allegation on that ground could not be made; and appellant then changed his plea and was sentenced. Appellant contends that the trial court should have entertained and granted a motion to strike the use allegation because the gun was not operable.[2]

SECTION 1237.5
Appellant's opening brief states that appellant filed a notice of appeal pursuant to rule 31(d) of the California Rules of Court, appealing the sentence portion only. The Attorney General raises no question about the propriety of the appeal. (1) However, appellate jurisdiction cannot be conferred by consent or waiver. (See 6 Witkin, Cal. Procedure (2d ed. 1971) Appeal, §§ 30-32.)
Section 1237.5 and rule 31(d) of the California Rules of Court provide that an appeal from a judgment of conviction entered upon a plea of guilty shall not be operative without a certificate of probable cause for the appeal. The record does not show any certificate in this case.
Rule 31(d) also provides that the requirement of a certificate of probable cause is not applicable to an appeal from a judgment of conviction entered upon a plea of guilty if the appeal is based solely upon grounds occurring after entry of the plea, which do not challenge the validity of the plea. Appellant purports to come under that exception, by appealing only from the sentence.
(2a) Calling this an appeal from the sentence does not make it so. If the plea (robbery with use of a firearm) is correct, the sentence is correct, and appellant does not contend to the contrary. Appellant is actually alleging error as to a ruling or indication by the court before the plea. This he cannot do under section 1237.5 and rule 31(d) of the Rules of Court.
*1151 It could be argued that the admission of use of a firearm was after the plea of guilty to robbery (by a few seconds), and therefore an appeal regarding the validity or truth of that admission would be within the exception stated in rule 31(d). A similar contention regarding a motion to withdraw a guilty plea was rejected in People v. Ribero (1971) 4 Cal.3d 55, 63-64 [92 Cal. Rptr. 692, 480 P.2d 308].
Section 1237.5 applies to a judgment of conviction after a "plea of guilty or nolo contendere." At issue here is the validity or truth of a "use" allegation. A technical, literal argument could be made that defendants do not "plead guilty" to enhancement allegations, they "admit" them. We can see no reason to draw such a fine distinction regarding the words used. Appellant's attack goes to his guilt or innocence, the truth of the alleged enhancement, and would require consideration of evidence. Such issues have been removed from consideration by the plea and admission. (Cf. People v. Pinon (1979) 96 Cal. App.3d 904, 908-910 [158 Cal. Rptr. 425].) Absent compliance with section 1237.5, an appeal attacking a sentence as disproportionate was rejected because it would require consideration of the facts of the case. (People v. Sabados (1984) 160 Cal. App.3d 691, 694-695 [206 Cal. Rptr. 799].) An appeal claiming defendant had not in fact admitted a prior prison term alleged as an enhancement of sentence was held to be barred by section 1237.5. (People v. Williams (1980) 103 Cal. App.3d 507, 511-512 [163 Cal. Rptr. 169].) (3) (See fn. 3.), (2b) By similar reasoning, we conclude that an appeal which questions proceedings before appellant's admission of the use of a firearm must comply with section 1237.5.[3]


*1152 SCOPE OF REVIEW AFTER PLEA
Even if appellant had sought and obtained a certificate of probable cause under section 1237.5, the contention urged could not be reviewed on an appeal after a plea of guilty. (4) A guilty plea admits all matters essential to the conviction, and the only matters reviewable on appeal are those based on constitutional, jurisdictional, or other grounds going to the legality of the proceedings. (People v. DeVaughn (1977) 18 Cal.3d 889 [135 Cal. Rptr. 786, 558 P.2d 872]; § 1237.5.)
Thus, denial of a discovery motion cannot be reviewed on appeal after a plea of guilty, because the purpose of the motion relates to guilt or innocence, an issue which is removed by the guilty plea. (People v. Castro (1974) 42 Cal. App.3d 960, 963 [117 Cal. Rptr. 295].) (5) A guilty plea forecloses review of a contention that a prior conviction was a misdemeanor and not a felony as required to be an element of the offense. (People v. Pinon (1979) 96 Cal. App.3d 904, 910 [158 Cal. Rptr. 425].) Also foreclosed was a claim that a prior conviction was invalid for failure to show advisement and waiver of constitutional rights. (People v. LaJocies (1981) 119 Cal. App.3d 947, 957 [174 Cal. Rptr. 100].) A plea of nolo contendere foreclosed appellate review of a contention that criminal prosecution for welfare fraud was barred by collateral estoppel. (People v. Shults (1984) 151 Cal. App.3d 714 [199 Cal. Rptr. 33]. See Witkin, Cal. Criminal Procedure (1983 Supp., pt. I) § 639C for other examples.)
(2c) Appellant's ground of appeal goes to matters occurring before the plea and affecting the validity of the plea, but not constitutionality or jurisdiction. As noted, it would require consideration of evidence at the preliminary hearing and of proceedings before the plea. Aside from the procedural bar of section 1237.5, the limited scope of review after a guilty plea precludes review of appellant's contention.

DISPOSITION
(6) Even if there were no bar to consideration of appellant's contention, his contention is without merit. The trial court was correct. Operability of a firearm is not required by section 12022.5, which provides for enhancing a sentence for use of a firearm during commission of a felony. (People v. Jackson (1979) 92 Cal. App.3d 899 [155 Cal. Rptr. 305]; and see People v. Nelums (1982) 31 Cal.3d 355, 359 [182 Cal. Rptr. 515, 644 P.2d 201].)[4]
*1153 (2d) Appellant's ground of appeal goes to matters occurring before the plea and affecting the validity of the plea. The appeal is not solely from the sentence. A certificate of probable cause for the appeal is required, and has not been presented. Under those circumstances, rule 31(d) provides that the appeal shall not be operative.
The appeal is dismissed.
Feinerman, P.J., and Ashby, J., concurred.
NOTES
[*]   Assigned by the Chairperson of the Judicial Council.
[1]  All statutory references are to the Penal Code unless otherwise indicated.
[2]  Appellant refers to testimony at his preliminary hearing as evidentiary support for his contention.
[3]  As noted, section 1237.5 applies to an appeal from a judgment of conviction upon a plea of guilty. A defendant can plead guilty to a main charge, and yet have a trial on an additional allegation, such as enhancement of sentence for "use" of a firearm (People v. Nelums (1982), 31 Cal.3d 355 [185 Cal. Rptr. 515, 644 P.2d 201]), or enhancement for being "armed" (People v. Casarez (1981) 124 Cal. App.3d 641 [177 Cal. Rptr. 451]). The trial regarding the enhancement could then be reviewed without a certificate of probable cause because it would be contested, there would be a record, and the appeal would not be attacking the validity of a plea of guilty regarding the enhancements.

In People v. Sumstine (1984) 36 Cal.3d 909, 914 [206 Cal. Rptr. 707, 687 P.2d 904], the defendant pleaded guilty to three sex offenses, and admitted the factual basis of an allegation of a prior similar conviction, reserving the right to challenge its constitutional validity. He appealed but failed to obtain a certificate of probable cause for an appeal. The Supreme Court noted, at footnote 3, pages 915-916, that the formal requirements of section 1237.5 do not apply where, as there, "the defendant is not challenging the validity of his guilty plea but is alleging error in the sentencing proceedings following entry of the plea. [Citations.]" Section 1237.5 did not apply, because defendant, when he pleaded, reserved the right to challenge the constitutionality of the prior, and at the sentencing hearing, defendant presented, and the trial court heard and ruled on, a motion to strike the prior allegation on stated constitutional grounds. Defendant was able to obtain review of the denial of his motion because it was a hearing reserved by the plea, and not merely because it affected his sentence.
[4]  Courts have also held that operability of a firearm is not required by the following sections: (1) Section 4574  possession of a firearm while confined in jail (People v. Talkington (1983) 140 Cal. App.3d 557 [189 Cal. Rptr. 735]), (2) Section 12020  possession of a sawed-off shotgun (People v. Favalora (1974) 42 Cal. App.3d 988, 991 [117 Cal. Rptr. 291]), (3) Section 12021  possession of a concealable firearm by an ex-felon (People v. Thompson (1977) 72 Cal. App.3d 1 [139 Cal. Rptr. 800]), (4) Section 12022, subdivision (a)  enhancing a sentence for being armed during commission of a felony (People v. Nelums, supra, 31 Cal.3d 355), and (5) Section 12031, subdivision (a)  carrying a loaded firearm in public in an incorporated city (People v. Taylor (1984) 151 Cal. App.3d 432 [199 Cal. Rptr. 6]). The court in Nelums stated, at page 359: "The majority of appellate courts, with respect to section 12022.5 (firearm use), has generally concluded that the deterrence objectives of that statute are best fulfilled by imposing an enhanced penalty whether or not the weapon is a functioning firearm." The court concluded: "As with section 12022.5, nothing in the language of section 12022 requires that the People demonstrate the weapon's operability."
