Am Fri, 22 Jul 2016 01:48:52 +0000
schrieb Rufus Smith <rufussm...@indi.com>:

> I would like to combine two types
> 
> 
> template Foo(A, B = 4)
> {
>      union
>      {
>         byte b = B;
>         int a = A << 8;
>      }
> }
> 
> 
> I get an error about overlapping default initialization. They 
> don't actually overlap in this case because of the shift.

To be pedantic about this: The initializers actually do overlap. As A
<< 8 shifts in zeroes, these bits are initialized as well. I think
there's no idiomatic way to initialize only part of an integer.

Reply via email to