Metal complexes as catalysts for the synthesis of heterocycles