
336 S.E.2d 394 (1985)
TOWN OF NAGS HEAD
v.
Robert C. TILLETT; Zenova P. Tillett; Bradford Neil Loy; Peter L. Marshall and wife, Flora Costin Marshall; Dorothy Hand Wagoner and husband, James L. Wagoner, Sr.; Richard L. Russakoff and wife, Rise Gury Russakoff; James T. Ryce and wife, Susan Ryce; and E. Crouse Gray, Jr., Trustee.
No. 436PA84.
Supreme Court of North Carolina.
November 5, 1985.
*395 Kellogg, White, Evans, Sharp and Michael by Thomas L. White, Jr., Manteo, for plaintiff-appellee.
Shearin & Archbell by Norman W. Shearin, Jr., Kitty Hawk, for defendant-appellee Bradford Neil Loy.
LeRoy, Wells, Shaw, Hornthal & Riley by L.P. Hornthal, Jr. and Donald C. Prentiss, Elizabeth City, for defendant-appellants James T. and Susan Ryce.
MARTIN, Justice.
In January of 1982, Susan and James T. Ryce applied to the Town of Nags Head for a building permit for a lot they had purchased from Bradford Neil Loy in 1980. The lot was one of four parcels created *396 three years earlier by the subdivision of a 6.8-acre tract of land belonging to Robert C. and Zenova P. Tillett. The Ryces were denied a building permit on the grounds that their lot violated several provisions of the Nags Head Code of Ordinances, all of which appear in chapter 17, entitled "Subdivision of Land." Specifically, the subdivision had never been approved by the town planning board, the lot did not meet frontage requirements, and it did not front on an improved street as described in both subdivision and zoning ordinances.[1]
On 29 March 1982 the Town of Nags Head brought a declaratory judgment action seeking to have all deeds deriving from the original 1977 division of the Tillett tract declared void and to enjoin all future conveyances of the property that violate municipal and state subdivision laws. Defendants Ryce counterclaimed, alleging their entitlement to a mandatory injunction compelling the issuance of a building permit and enjoining interference with the use of their property. In the alternative, defendants Ryce cross-claimed against defendant Loy, asking that if the trial court found in plaintiff's favor, it grant rescission of the sales contract and deed between them and Loy and restitution of their purchase price and expenditures.
The trial court dismissed the town's declaratory judgment action and enjoined the town from denying a building permit to defendants Ryce. The Court of Appeals, 68 N.C.App. 554, 315 S.E.2d 740, affirmed the dismissal of the declaratory judgment action but vacated the trial court's injunction concerning the denial of a building permit.
The appellate court did not address the Ryces' cross-assignment of error concerning the cross-claim against defendant Loy. A Ryce petition for rehearing was denied by that court on 12 July 1984. We reversed the Court of Appeals' denial and ordered a rehearing on the merits of the cross appeal, 312 N.C. 491, 322 S.E.2d 565. On 4 December 1984 the Court of Appeals filed an order finding the cross-assignment of error to be without merit. This Court granted defendants Ryce's petition for discretionary review in order to address two questions remaining in this case: (1) the validity of the denial of a building permit by the Town of Nags Head and (2) the merits of the Ryce cross-claim, 313 N.C. 515, 329 S.E.2d 405. We affirm in part, reverse in part, and remand.
The Court of Appeals concluded, and we agree, that the Declaratory Judgment Act is restricted to declaring the rights and liabilities of parties regarding property, but that for "the [trial] court to find that the conveyances are void as a matter of law" was beyond the scope of the act. Town of Nags Head v. Tillett, 68 N.C.App. 554, 558, 315 S.E.2d 740, 742. We agree as well that an injunction will not lie to restrain an act already completed at the time the action is instituted.[2]Austin v. Dare County, 240 N.C. 662, 83 S.E.2d 702 (1954). In addition, the Court of Appeals correctly stated that the enabling statute at issue in this case provides no basis for voiding a conveyance of real property that fails to meet subdivision requisites. An exception to the general rule that an agreement that violates the law whether constitution, statute, or municipal ordinanceis illegal and void was delineated by this Court in Financial Services v. Capitol Funds, 288 N.C. 122, 217 S.E.2d 551 (1975). We held in Financial Services that where the statute expressly designates the offense and clearly states the punishment for its violation, "the legislative bodies dealt with the matter completely and did not intend to invalidate conveyances of real property because of failure to *397 follow the provisions of this penal legislation." Id. at 135, 217 S.E.2d at 560.
Of the two questions remaining for this Court to resolve, that of the validity of the town's denying a building permit to defendants Ryce can be fruitfully addressed by examining the town ordinances and state statutes supposedly authorizing that means of compelling compliance.
Chapter 160A of the General Statutes of North Carolina contains enabling legislation for city and town ordinances regulating subdivision and zoning. Article 19 of that chapter is deliberately divided into eight parts. Two of these provide separately for the regulation of subdivisions and for zoning. The specific penal and equitable relief set out in section 160A-375 is relief intended to deter those who violate subdivision ordinances;[3] section 160A-389 permits broader, "appropriate" action and proceedings to prevent or correct the violation of a zoning ordinance.[4]
The Nags Head Code of Ordinances similarly contains enforcement provisions for subdivision regulation that are distinctly separate from enforcement provisions for zoning regulation. The code's chapter 17 is dedicated to subdivision regulation. Section 17-10 of that chapter tracks the language of N.C.G.S. 160A-375, authorizing a criminal penalty and injunctive remedies for violations of subdivision ordinances. Section 17-11 posits that before a building permit can be issued for the erection of any structure in a proposed subdivision by the subdivider or his agent, the subdivision must be approved in accordance with the chapter.[5] Section 3.08 of the Nags Head zoning ordinance also prohibits the issuance of a building permit for any lot that does not front on a public right-of-way at least thirty feet wide.
It is clear to us that the penal and injunctive provisions of section 17-10 do not exceed the scope of that section's parallel enabling legislation, N.C.G.S. 160A-375. It is likewise clear that the remedial breadth of N.C.G.S. 160A-389 supports the enforcement provisions of such zoning ordinances as section 3.08.
But it is another matter to cite the broad enforcement provisions of N.C.G.S. 160A-389, a zoning statute, as the statutory basis for denying a building permit to one whose lot violates the subdivision requirements of chapter 17 of the Nags Head Code of Ordinances. The Court of Appeals therefore erred in citing that statute and listing a number of subdivision ordinance violations by the Ryce lot as justification for vacating the order of the trial court that enjoined the town from denying the Ryces a building permit.
*398 Insofar as the Town of Nags Head rests its denial of a building permit upon the violation of the zoning laws, however, the broader enforcement license of N.C.G.S. 160A-381 applies and would sustain such a remedy. In the event that the Ryces' attempts to obtain a building permit remain frustrated by the nonconforming nature of their property so that they cannot reasonably use their property for residential purposes, then they are entitled to rescission for a material failure of consideration under the contract of sale and deed with defendant Loy.
The contract of sale between Loy and the Ryces provided that there "must be no ... governmental regulation that would prevent the reasonable use of the property for residential purposes." The contract also contained a survival clause, stating that any provision of the contract required by its nature and effect to be observed or performed after the closing should remain binding after the closing until satisfied. The deed specifically stated that the conveyances were "pursuant to said contract and subject to its terms." Such language in the deed is irrefutable evidence of the parties' intention that the contract not merge into the deed.
In the event that the Ryces are unable to obtain a building permit for residential purposes, it would constitute a material breach of their contract with Loy, defeating the very terms of the contract. Childress v. Trading Post, 247 N.C. 150, 100 S.E.2d 391 (1957). Whereupon, defendants Ryce would be entitled to be restored to the condition they occupied on the day the contract was entered into. Id. The 4 December 1984 order of the Court of Appeals, ruling that the Ryces' cross-claim was without merit, is reversed.
Accordingly, we hold that although the town may deny a building permit to applicants whose property violates zoning ordinances, as authorized by section 3.08 of the Nags Head Code of Ordinances and by N.C.G.S. 160A-389, its enforcement of subdivision ordinances is restricted to the penal and injunctive relief of N.C.G.S. 160A-375 and section 17.10 of the code of ordinances. In addition, insofar as defendants Ryce are thwarted by the execution of such ordinances and statutes from the reasonable use of their property for residential purposes, they are entitled to rescission of the instruments of conveyance with Loy and restitution.
AFFIRMED IN PART, REVERSED IN PART, AND REMANDED.
NOTES
[1]  Section 17-27 of the Nags Head subdivision ordinance requires residential streets to be paved and of a minimum width. Section 3.08 of the town's zoning ordinance similarly prohibits structures on lots not abutting a public right-of-way of a minimum width. The narrow clay road serving the Ryce lot met the requirements of neither of these ordinances.
[2]  Apropos, plaintiff's argument that N.C.G.S. 160A-175, which provides general equitable enforcement powers, authorizes invalidation of the conveyances is unavailing.
[3]  § 160A-375. Penalties for transferring lots in unapproved subdivisions.

If a city adopts an ordinance regulating the subdivision of land as authorized herein, any person who, being the owner or agent of the owner of any land located within the jurisdiction of that city, thereafter subdivides his land in violation of the ordinance or transfers or sells land by reference to, exhibition of, or any other use of a plat showing a subdivision of the land before the plat has been properly approved under such ordinance and recorded in the office of the appropriate register of deeds, shall be guilty of a misdemeanor. The description by metes and bounds in the instrument of transfer or other document used in the process of selling or transferring land shall not exempt the transaction from this penalty. The city may bring an action for injunction of any illegal subdivision, transfer, conveyance, or sale of land, and the court shall, upon appropriate findings, issue an injunction and order requiring the offending party to comply with the subdivision ordinance.
[4]  § 160A-389. Remedies.

If a building or structure is erected, constructed, reconstructed, altered, repaired, converted, or maintained, or any building, structure or land is used in violation of this Part or of any ordinance or other regulation made under authority conferred thereby, the city, in addition to other remedies, may institute any appropriate action or proceedings to prevent the unlawful erection, construction, reconstruction, alteration, repair, conversion, maintenance or use, to restrain, correct or abate the violation, to prevent occupancy of the building, structure or land, or to prevent any illegal act, conduct, business or use in or about the premises.
[5]  It is noteworthy that these sections govern the acts of the subdivider or his agent, not the purchaser of the lot.
