is_void<const void>

Daniel Krügler daniel.kruegler@googlemail.com
Fri Mar 23 16:22:00 GMT 2012


Am 23. März 2012 15:22 schrieb Daniel Krügler <daniel.kruegler@googlemail.com>:
> Am 23. März 2012 15:01 schrieb Jonathan Wakely <jwakely.gcc@gmail.com>:
>> From 3.9.3 [basic.type.qualifier] cv-qualified void types are distinct
>> from void itself, and from 20.9.4.1 [meta.unary.cat] says is_void<T>
>> is true if T is void, so by my reading is_void<const void> should be
>> false, meaning we have a bug.
>>
>> Should we remove the remove_cv in the definition of std::is_void?
>>
>> It could be simplified to be just:
>>
>> template<typename T>
>> struct is_void : __is_void_helper<T>
>> { };
>
> I would stay away from such a decision. With the same rationale one
> should change is_floating_point to have the effect to reject:
>
> #include <type_traits>
> static_assert(std::is_floating_point<const double>::value, "");
>
> and for the integer types similarly. There exists an open core issue about
> why the cv variants are not mentioned here for int types (#251).
>
> I tend to suggest open a library issue for these. I know from Howard
> that the intention of is_void clearly should include all cv variants
> (as well as for floating point types and integral types).

No reason for an issue, [meta.unary.cat] p2 says:

"For any given type T, the result of applying one of these templates to T and
to cv-qualified T shall yield the same result."

- Daniel



More information about the Libstdc++ mailing list