This happened with Philip II of Spain. I was just reading also that it was not initially supported and even by St. Pius V, but it still happened that he was able to marry his niece somehow. I would guess it is surely an impediment now that cannot be dispensed, but I don't know. In those days, it would have probably required a dispensation since there was a relationship of consanguinity. It did not completely work though since the heir Philip III was the only child who survived the longest, and the direct male line itself died out eventually, resulting in the situations of the Spanish War of Succession and later the now ongoing dispute between the Legitimists and Orleanists over the succession to the French throne.
It only goes to show that the Portuguese man in question is not making a wise decision, even if were not to lead to something like that described above, although just merely for reasons of common sense to not marry a relative too closely related through consanguinity.