On 09/02/2016 10:35, Jeff Schwab wrote:
On Tue, Feb 9, 2016 at 5:08 AM, John Maddock
mailto:jz.maddock@googlemail.com> wrote: There is no static data in mpz_int being relied on here.
OK, but what is causing the initialization order issue? Reordering definitions in the OP's code does not change the error, and the warning is coming from gmp.hpp.
The initialization of: factorial2<N>::value depends on factorial2<N-1>::value being already initialized, but there is no guaranteed ordering for initialization of instances of factorial2<M>::value As I understand it, the compiler can choose any order it wants - alphabetical, order of instantiation, random, or "whatever". GCC chooses an order that accidentally works in this particular case, whereas clang does not. John.