I would guess that std::static_assert(!(std::is_pointer<Src>::value &&
std::is_pointer<Dst>::value), "bit casting pointers doesn't solve the
strict aliasing issue"); gives a better error message than linking error.

Vyacheslav Egorov

On Wed, Dec 9, 2015 at 11:04 AM, Benedikt Meurer <bmeu...@chromium.org>
wrote:

> How about adding overloads for the template with pointers w/o
> implementation?
>
> On Wed, Dec 9, 2015 at 10:59 AM, 'Erik Corry' via v8-dev <
> v8-dev@googlegroups.com> wrote:
>
>> Yes.  We plan to put in asserts to prevent it being used for pointer
>> types.
>>
>> On 4 December 2015 at 15:30, Jochen Eisinger <joc...@chromium.org> wrote:
>>
>>> thanks for the heads-up.
>>>
>>> Did you keep the bit_casts in fletch for non-pointer types?
>>>
>>> On Thu, Dec 3, 2015 at 2:34 PM 'Erik Corry' via v8-dev <
>>> v8-dev@googlegroups.com> wrote:
>>>
>>>> Slava points out that I am writing about use of bit_cast for pointer
>>>> types (eg casting an Object** to a Class**), but ignoring the other use of
>>>> bit_cast (eg casting a float to a uint32_t).  It's only the pointer types
>>>> that are problematic, I think.
>>>>
>>>> On 3 December 2015 at 13:37, Erik Corry <erikco...@google.com> wrote:
>>>>
>>>>> Some investigation by ager and some asking around has resulted in the
>>>>> conclusion that bit_cast only serves to prevent warnings.  It doesn't
>>>>> actually fix the program's use of undefined behaviour.  Mads was able to
>>>>> get gcc to generate broken code for a function with strict aliasing issues
>>>>> both with and without bit_cast.
>>>>>
>>>>> We have ripped bit_cast out of Fletch, replacing it with
>>>>> reinterpret_cast everywhere.
>>>>>
>>>>> We have also added the -fno-strict-aliasing, since there's no sensible
>>>>> way to fix a GC and a runtime for a dynamic language so it doesn't alias
>>>>> pointers.  (The only way I can think of involves getting rid of the C++
>>>>> "Object" class and treating the heap as a char array, which would be
>>>>> horrible beyond belief).  This flag is available on both Clang and gcc, 
>>>>> and
>>>>> is the default behaviour for MSVC.  If you add the same flag to V8 you may
>>>>> see a small performance regression on Linux, but not on Mac and Windows
>>>>> where I think it already is the default.
>>>>>
>>>>> --
>>>>> Erik Corry
>>>>>
>>>>> Google Denmark ApS
>>>>> Frederiksborggade 20B, 1 sal
>>>>> 1360 København K
>>>>> Denmark
>>>>> CVR nr. 28 86 69 84
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> Erik Corry
>>>>
>>>> Google Denmark ApS
>>>> Frederiksborggade 20B, 1 sal
>>>> 1360 København K
>>>> Denmark
>>>> CVR nr. 28 86 69 84
>>>>
>>>> --
>>>> --
>>>> v8-dev mailing list
>>>> v8-dev@googlegroups.com
>>>> http://groups.google.com/group/v8-dev
>>>> ---
>>>> You received this message because you are subscribed to the Google
>>>> Groups "v8-dev" group.
>>>> To unsubscribe from this group and stop receiving emails from it, send
>>>> an email to v8-dev+unsubscr...@googlegroups.com.
>>>> For more options, visit https://groups.google.com/d/optout.
>>>>
>>> --
>>> --
>>> v8-dev mailing list
>>> v8-dev@googlegroups.com
>>> http://groups.google.com/group/v8-dev
>>> ---
>>> You received this message because you are subscribed to the Google
>>> Groups "v8-dev" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to v8-dev+unsubscr...@googlegroups.com.
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>
>>
>> --
>> Erik Corry
>>
>> Google Denmark ApS
>> Frederiksborggade 20B, 1 sal
>> 1360 København K
>> Denmark
>> CVR nr. 28 86 69 84
>>
>> --
>> --
>> v8-dev mailing list
>> v8-dev@googlegroups.com
>> http://groups.google.com/group/v8-dev
>> ---
>> You received this message because you are subscribed to the Google Groups
>> "v8-dev" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to v8-dev+unsubscr...@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
> --
> --
> v8-dev mailing list
> v8-dev@googlegroups.com
> http://groups.google.com/group/v8-dev
> ---
> You received this message because you are subscribed to the Google Groups
> "v8-dev" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to v8-dev+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
-- 
v8-dev mailing list
v8-dev@googlegroups.com
http://groups.google.com/group/v8-dev
--- 
You received this message because you are subscribed to the Google Groups 
"v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to v8-dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to