delivered the opinion of the court:
On January 4, 1979, Robert Wagner was indicted by a St. Clair County grand jury for an alleged delivery on August 3,1978, of .4 grams of a substance represented to be a controlled substance (heroin), in violation of section 404 of the Illinois Controlled Substances Act (Ill. Rev. Stat. 1977, ch. 56½, par. 1404). Prior to trial the defendant moved to dismiss the indictment contending that section 404 was unconstitutional. The court denied the motion. On March 12, 1979, the defendant was found guilty after a trial before the court sitting without a jury. On May 4, 1979, he was sentenced to a two-year prison term. The appellate court, in a split decision, affirmed the conviction. (91 Ill. App. 3d 254.) We granted the defendant’s petition for leave to appeal.
According to the Illinois Controlled Substances Act (Ill. Rev. Stat. 1977, ch. 56½, par. 1100 et seq.) at the time of this offense, delivery or possession of a schedule IV or V controlled substance was punishable as a Class 4 felony permitting the following fines: $15,000 for possession of a schedule IV or V controlled substance; $10,000 for delivery of a schedule IV controlled substance; $5,000 for delivery of a schedule V controlled substance. Delivery of a noncontrolled substance represented to be a controlled substance constituted a Class 3 felony permitting a $15,000 fine (Ill. Rev. Stat. 1977, ch. 56½, pars. 1401(e), (f), 1402(b), 1404).
The legislature on September 14, 1979, by Public Act 81—583, amended sections 401(e) and (f) to make delivery of a schedule IV or V controlled substance a Class 3 felony. Possession or delivery of a noncontrolled substance under section 404 still subjects one to a greater fine than may be imposed under sections 401(e) or (f) (Ill. Rev. Stat. 1979, ch. 56½, par. 1401).
The State contends (1) that the defendant lacks standing to contest the constitutionality of section 404, (2) the issue *311was waived, and (3) the appeal is moot. The State’s contentions are not meritorious.
An individual has standing to challenge the constitutionality of a statutory provision if he is directly affected as one “within the class aggrieved by the alleged unconstitutionality.” (People v. Mayberry (1976), 63 Ill. 2d 1, 6; cert. denied (1976), 429 U.S. 828, 50 L. Ed. 2d 92, 97 S. Ct. 87.) Because the noncontrolled substance was represented to be heroin the prosecution contends that this should affect the defendant’s standing to challenge the provision under which he was convicted. The nature of the purported substance is irrelevant under section 404, provided the delivery involved a substance represented to be a controlled substance. (Ill. Rev. Stat. 1977, ch. 56½, par. 1404.) Whether it was held out to be amphetamine, barbiturate or narcotic in the form of speed, valium, cocaine or heroin is not relevant as long as it was “represented to be” any of those “controlled substances.” As a result of the enforcement of the penalty provision in question the defendant sustained the direct and palpable injury of incarceration. He clearly has standing to challenge the validity of the statute. 63 Ill. 2d 1, 8.
The defendant had moved prior to trial to dismiss the charge based upon the unconstitutionality of the statute. The defendant did not make a post-trial motion to dismiss in the trial court. The State argues that the defendant’s failure to do so effectively waived the issue of whether section 404 of the Illinois Controlled Substances Act violates the Illinois Constitution. This is not an instance where the trial judge is in a position to correct errors made at trial. The record clearly indicates that a pretrial motion was made and denied. Since the conviction here is under an unconstitutional statute and is therefore a nullity, it was not necessary for defendant to preserve the error by a post-trial motion. The conviction is void and can be attacked at any time. People v. Walker (1980), 83 Ill. 2d 306, 313; People v. *312 Furman (1962), 26 Ill. 2d 334, 335; People v. Edge (1950), 406 Ill. 490, 494.
The appeal is not moot. Although the defendant has completed his term of imprisonment and supervised release, his conviction subjects him to the possibility of an extended term of imprisonment, should he be convicted of another felony within a fixed period of time (Ill. Rev. Stat. 1977, ch. 38, pars. 1005—5—3.2, 1005—8—2). This collateral legal consequence precludes any finding that this appeal is moot. In re Sciara (1974), 21 Ill. App. 3d 889; Sibron v. New York (1968), 392 U.S. 40, 20 L. Ed. 2d 917, 88 S. Ct. 1889. See People v. Nunn (1979), 77 Ill. 2d 243.
When this appeal was pending, we announced our decision in People v. Bradley (1980), 79 Ill. 2d 410. We held that section 402(b) of the Illinois Controlled Substances Act (Ill. Rev. Stat. 1977, ch. 56½, par. 1402(b)) violated article I, section 2, of the Illinois Constitution (Ill. Const. 1970, art. I, sec. 2). Section 402(b) had permitted a greater penalty for possession of a schedule IV controlled substance than section 401(e) permitted for delivery of the same controlled substance (Ill. Rev. Stat. 1977, ch. 56½, par. 1401(e)). We concluded in Bradley that since the legislature clearly intended to punish trafficking in drugs more severely than possession, section 402(b) was “not reasonably designed to remedy the evil which the legislature determined to be a greater threat to the public.” 79 Ill. 2d 410, 418.
The appellate court held in the instant case that the reasoning of Bradley did not apply. We disagree. It is applicable, persuasive and controlling. The legislature expressly “acknowledge [d] the functional and consequential differences between the various types of controlled substances and provide[d] for correspondingly different degrees of control over each of the various types.” (Ill. Rev. Stat. 1977, ch. 56½, par. 1100(4).) In view of that language the legislature need not expressly recognize the functional *313and consequential differences between harmful controlled substances and harmless noncontrolled substances. That distinction is obvious.
Fraudulent deliveries of noncontrolled substances are punishable “to discourage illicit traffic in narcotics.” (People v. Calcaterra (1965), 33 Ill. 2d 541, 545.) The plain purpose of the Illinois Controlled Substances Act is to deter the traffic in controlled substances by punishing the traffickers and/or profiteers more severely. (People v. Bradley (1980), 79 Ill. 2d 410, 418.) The defendant here was subject to a greater penalty for delivery of .4 grams of a harmless brown powder than a person who would have actually delivered any amount of a schedule IV or V controlled substance under sections 401(e) and (f). The defendant incurred the penal liability that attaches to a Class 3 felony while the latter offense constituted only a Class 4 felony. Just as delivery of a controlled substance represents a greater threat to the public under the Illinois Controlled Substances Act than the possession of a controlled substance, the delivery of a controlled substance represents a greater threat to the public than the delivery of a noncontrolled harmless substance. Here, as in Bradley, the less serious threat to the public carries á harsher punishment than the greater threat. We concur with the appellate court’s dissent that it is not reasonable to assume that a person selling large dosages of valium should be subjected to a less severe sentence than a person giving away a No-doz pill representing it to be an amphetamine. It is not logical to believe that the legislature intended to punish one who delivers a noncontrolled substance more severely than one who delivers a controlled substance.
Section 404 is not reasonably designed to remedy the evil which the legislature determined to be a greater threat to the public. As such, section 404 violates the due process clause of the Illinois Constitution (Ill. Const. 1970, art. I, sec. 2).
*314The defendant’s conviction under section 404 cannot stand. The judgments of the appellate and circuit courts are reversed.
Judgments reversed.