RFR: 8073994: STATIC_ASSERT use of __LINE__ is wrong
Kim Barrett
kim.barrett at oracle.com
Thu Mar 5 16:55:20 UTC 2015
On Mar 4, 2015, at 7:27 PM, David Holmes <david.holmes at oracle.com> wrote:
>
> Hi Kim,
>
> On 5/03/2015 6:14 AM, Kim Barrett wrote:
>> Please review this small cleanup of the infrastructure underlying the
>> STATIC_ASSERT macro.
>>
>> I will need a sponsor for this change.
>>
>> STATIC_ASSERT is using macro token splicing incorrectly to (attempt
>> to) produce a unique type name. Rather than fixing the splicing we
>> note that the unique type name isn't actually needed.
>>
>> - If the assertion fails the type name never gets used at all.
>
> I can't figure out what this means if cond is false:
>
> typedef char STATIC_ASSERT_DUMMY_TYPE[ STATIC_ASSERT_FAILURE< (Cond) >::value ]
We get a compiler error for attempting to access the non-existent
STATIC_ASSERT_FAILURE<false>::value
member before the compiler has any chance of complaining about a possible redefinition
of STATIC_ASSERT_DUMMY_TYPE.
More information about the hotspot-dev
mailing list