Boost logo

Boost Users :

Subject: Re: [Boost-users] [Multiprecision] Runtime assertion failure with clang++3.6.0 but not g++4.9.2
From: John Maddock (jz.maddock_at_[hidden])
Date: 2016-02-09 07:56:20


On 09/02/2016 10:35, Jeff Schwab wrote:
>
>
> On Tue, Feb 9, 2016 at 5:08 AM, John Maddock
> <jz.maddock_at_[hidden] <mailto:jz.maddock_at_[hidden]>> 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.


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net