A facile, convenient, green and environmentally benign one-pot three-component synthesis of poly-functionalized 4H-pyrans and 4H-chromenes is described. A basic ionic liquid 2-(2-hydroxyethoxy)ethaneammonium formate was found to be an efficient catalyst or catalytically active solvent for the synthesis of those important classes of heterocyclic compounds.