Since gender is a protected classification under the 14th amendment, albeit at a lower level of scurutiny, the measure is subject to challenge. The test is intermediate scrutiny, the state must demonstrate an "important state interest" that the measure in question is "substantially related" to furthering. Either this test is passed, or the measure is unconstitutional. And this same test does not apply to polygamy or pedophiles or bestiality, because none of those things are protected classifications.
Some argue that because SCOTUS has repeatedly defined marriage as a "fundamental right," this means the test of strict scrutiny applies. I'm not really convinced, and this logic makes any marriage-based distinction subject to strict scrutiny. And it seems excessive to me that things like tax brackets and license fees all be subject to strict constitutional scrutiny.
Even if intermediate scrutiny doesn't apply, same sex marriage bans do not pass even the rational basis test. Absolutely no state interest is furthered by preventing a same sex couple from marrying. Merely being legislatively or democratically enacted does not pass this test, because if "it was enacted" passes constitutional scrutiny then it's not a test at all.