A motion making any of these defenses shall be made before pleading if a further pleading is permitted. The consequences of failure to make such a motion shall be as provided in sections (g) and (h). No defense or objection is waived by being joined with one or more other defenses or objections in a responsive pleading or motion. Obtaining an extension of time within which to answer or otherwise plead shall not constitute a waiver of any defense herein set forth. If a pleading sets forth a claim for relief to which the adverse party is not required to serve a responsive pleading, he may assert at the trial any defense in law or fact to that claim for relief. If, on a motion asserting the defense numbered (6), to dismiss for failure of the pleading to state a claim upon which relief can be granted, matters outside the pleading are presented to and not excluded by the court, the motion shall be treated as one for summary judgment and disposed of as provided in Rule 56, and all parties shall be given reasonable opportunity to present all material made pertinent to such a motion by Rule 56.
N.C. Gen. Stat. § 12