
243 Ga. 259 (1979)
253 S.E.2d 727
HAMMOCK
v.
ZANT.
34508.
Supreme Court of Georgia.
Argued February 20, 1979.
Decided March 6, 1979.
F. Robert Raley, John E. Simmons, for appellant.
Arthur K. Bolton, Attorney General, Susan V. Boleyn, Assistant Attorney General, Jack L. Park, Jr., Special Assistant Attorney General, for appellee.
UNDERCOFLER, Presiding Justice.
Hammock was indicted, convicted and sentenced to ten years on a conspiracy charge. On appeal, in Hammock v. State, 146 Ga. App. 339 (246 SE2d 392) (1978), he claimed the indictment was not sufficient to put him on notice that he was being charged with conspiracy under the Georgia Controlled Substances Act, Code Ann. § 79A-812, and raised a constitutional challenge to the statute for the first time. The Court of Appeals found the indictment was sufficient, but refused to recognize the untimely constitutional challenge. Hammock then filed his habeas petition contending again that the statute was unconstitutional. The habeas court granted the state's motion to dismiss finding that his failure to raise the question at trial constituted a waiver. We granted his application to appeal and reverse.
"It is the firmly established general rule that the writ of habeas corpus can not be used as a substitute for a writ of error or other remedial procedure to correct errors of law, of which the defendant has had opportunity to avail himself. [Cits.] The recognized exception that `one indicted and tried under an unconstitutional statute may, even after final conviction, obtain his discharge from *260 custody on a writ of habeas corpus' (Moore v. Wheeler, 109 Ga. 62, 35 SE 116, and cit. [1899]), is itself qualified by the rule that `where the accused, upon the trial, brings in question the validity of the statute under which he has been indicted, and the point is decided against him, it then ... becomes res adjudicata, and can not be reviewed collaterally on habeas corpus.[1] [Cits.]" White v. Hornsby, 191 Ga. 462, 463 (12 SE2d 875) (1941) (Footnote added.) (Emphasis supplied.) The rationale is that the conviction under an unconstitutional statute is void (Bunn v. Burden, 237 Ga. 439 (228 SE2d 830 (1976)); a nullity which confers no subject matter jurisdiction on a court to convict and sentence under its provisions, Riley v. Garrett, 219 Ga. 345 (133 SE2d 367) (1963).
It is clear that the constitutional challenge has not already been ruled on at the trial or on appeal and is thus not barred by res judicata. Therefore, Hammock has not waived his right to raise the issue on habeas corpus. Reid v. Perkerson, 207 Ga. 27 (60 SE2d 151) (1950); Moore v. Wheeler, supra. Cf. Bunn v. Burden, supra; Riley v. Garrett, supra; Moore v. Burnett, 215 Ga. 146 (109 SE2d 605) (1959); White v. Hornsby, supra. Wilkes, Post Conviction Habeas Corpus Relief in Georgia, 12 Ga. L. Rev. 249, 257 (1978).
Judgment reversed. All the Justices concur.
NOTES
[1]  There is an exception to the res judicata rule in that habeas would likely be allowed if the law changed which might render a later challenge successful. Bunn v. Burden, supra.
