boost::mpl, c++11 and clang 3.0: compiler bug?
Hi
The following code compiles fine under clang 3.0 but I get unexpected output:
#include <iostream>
#include
On 17.01.2012, at 16:25, Allan Nielsen wrote:
Hi
The following code compiles fine under clang 3.0 but I get unexpected output: <snip>
The output I get is: 0 4 0 4 0 4
The output I expected is: 0 4 4 4 8 4
Could be a bug in Clang 3.0. I get the expected output in SVN HEAD. Sebastian
Allan Nielsen writes:
If I remove the copy constructor in Foo, it works as I expect, and if I do a "normal" initialization of AccSize::s it also works as I expect.
Is this a bug? If so, how can it be reproduced without mpl::foreach
The code works as expected (after removing the non-static member initializer) on gcc and this is the behaviour that is expected. To test without mpl::for_each just unroll the loop: AccSize < Foo > p; p(int()); p(int()); p(int());
Best regards Allan W. Nielsen
Cheers, Philipp Moeller
On Tue, Jan 17, 2012 at 4:45 PM, Philipp Moeller
Allan Nielsen writes:
If I remove the copy constructor in Foo, it works as I expect, and if I do a "normal" initialization of AccSize::s it also works as I expect.
Is this a bug? If so, how can it be reproduced without mpl::foreach
The code works as expected (after removing the non-static member initializer) on gcc and this is the behaviour that is expected.
To test without mpl::for_each just unroll the loop:
AccSize < Foo > p;
p(int()); p(int()); p(int());
I got a compile error on this, but tried the following instead: int i; AccSize < Foo > p; p(i); p(i); p(i); But as Sebastian can inform it works in Clang SVN-HEAD, then it is properly a bug in clang 3.0. Regards Allan W. Nielsen
participants (3)
-
Allan Nielsen
-
Philipp Moeller
-
Sebastian Redl