[type_traits] VC9/TR1 failures vs Boost

I've been running the Boost regression tests against VC9 with the beta TR1 feature pack, and raising some of the failures as bugs with MS.
From reading the standards, it seems that some of the test failures are in areas which have changed over time. The MS blog post @ <http://tinyurl.com/3b9ksc> mentions N2157 ( http://tinyurl.com/2r54lo ), so i assume that they're working on at least that revision.
So, from the tests: -tr1_is_base_of_test (http://tinyurl.com/2hzmae) is failing because Boost thinks is_base_of<int, int> should be true and VC9 says it's false. n2157 has the example "is_base_of<int, int>::value // false", so VC looks correct here. -tr1_is_convertible_test (http://tinyurl.com/2dortk) has 2 sets of failures: 1) is_convertible<float,void>/is_convertible<void,void> are both false, and Boost expects both to be true. n2157 says "If To and From are void types, the result is true. However if only one of To or From is a void type, then the result is false", which is a change to the spec. In this case, both Boost and VC9 seem to be wrong in one case. 2)is_convertible<float,convertible_from<float&>> is_convertible<char,convertible_from<char&>> are both false. n2157 says "Given a type T, the TR1 is_convertible<T, T&>::value is true whereas this paper proposes false unless T is a non-volatile but const qualified type", which sounds like VC is correct here. Does anyone with a better grasp of the current requirements have any thoughts on this? Thanks, Richard Webb

Richard Webb wrote:
I've been running the Boost regression tests against VC9 with the beta TR1 feature pack, and raising some of the failures as bugs with MS.
From reading the standards, it seems that some of the test failures are in areas which have changed over time. The MS blog post @ <http://tinyurl.com/3b9ksc> mentions N2157 ( http://tinyurl.com/2r54lo ), so i assume that they're working on at least that revision.
So, from the tests:
-tr1_is_base_of_test (http://tinyurl.com/2hzmae) is failing because Boost thinks is_base_of<int, int> should be true and VC9 says it's false. n2157 has the example "is_base_of<int, int>::value // false", so VC looks correct here.
Sigh... it depends, as far as TR1 is concerned this started out false, and then changed to true (in the final TR1 draft N1836 anyway). However, the std whitepaper has for the moment anyway changed it back again... well sort of anyway.
-tr1_is_convertible_test (http://tinyurl.com/2dortk) has 2 sets of failures:
1) is_convertible<float,void>/is_convertible<void,void> are both false, and Boost expects both to be true.
That's explicitly stated in the TR1.
n2157 says "If To and From are void types, the result is true. However if only one of To or From is a void type, then the result is false", which is a change to the spec.
Again this depends on whether you are tracking the latest WP or the TR1.
In this case, both Boost and VC9 seem to be wrong in one case.
2)is_convertible<float,convertible_from<float&>> is_convertible<char,convertible_from<char&>> are both false. n2157 says "Given a type T, the TR1 is_convertible<T, T&>::value is true whereas this paper proposes false unless T is a non-volatile but const qualified type", which sounds like VC is correct here.
That's a different situation, is_convertible<float,convertible_from<float&>> and is_convertible<float,float&> are two different beasts, but again I suspect this depends on whether you implement TR1 or track the latest std WP (which I believe can't be implemented without rvalue references). HTH, John.

John Maddock <john <at> johnmaddock.co.uk> writes: Nice :(
but again I suspect this depends on whether you implement TR1 or track the latest std WP
I'll ask what their intentions are.
(which I believe can't be implemented without rvalue references).
I ran into that when i was looking at a test failure with add_reference<void> (the Beta MS TR1 won't compile it) - the WP clarifies that void should be supported, but also replaces add_reference with add_(rvalue/lvalue)_reference. Still, at least i'm learning more about how all this stuff works while testing it! Thanks, Richard Webb

John Maddock wrote:
Richard Webb wrote:
I've been running the Boost regression tests against VC9 with the beta TR1 feature pack, and raising some of the failures as bugs with MS.
From reading the standards, it seems that some of the test failures are in areas which have changed over time. The MS blog post @ <http://tinyurl.com/3b9ksc> mentions N2157 ( http://tinyurl.com/2r54lo ), so i assume that they're working on at least that revision.
So, from the tests:
-tr1_is_base_of_test (http://tinyurl.com/2hzmae) is failing because Boost thinks is_base_of<int, int> should be true and VC9 says it's false. n2157 has the example "is_base_of<int, int>::value // false", so VC looks correct here.
Sigh... it depends, as far as TR1 is concerned this started out false, and then changed to true (in the final TR1 draft N1836 anyway). However, the std whitepaper has for the moment anyway changed it back again... well sort of anyway.
John, Do you have any idea if the change back in the current WP was deliberate or an editing glitch? Also, does your "well sort of anyway" comment mean you think the current WP is unclear? If so, please be sure to let Howard Hinnant know so he can open an issue. Thanks, --Beman

Beman Dawes <bdawes <at> acm.org> writes:
Sigh... it depends, as far as TR1 is concerned this started out false, and then changed to true (in the final TR1 draft N1836 anyway). However, the std whitepaper has for the moment anyway changed it back again... well sort of anyway.
John,
Do you have any idea if the change back in the current WP was deliberate or an editing glitch? Also, does your "well sort of anyway" comment mean you think the current WP is unclear?
TR1 says that 'is_base_of<T, U> is true if T and U are the same type'. The WP removes the 'is the same type' bit, but adds an 'a class is considered it's own base'. I read this as: TR1: is_base_of<T, T> is true WP: is_base_of<T, T> is true if T is a class and false otherwise (for int in this example). Is this what you mean? (i don't know what the pre-n1836 spec said, so i'm just guessing here).

Beman Dawes wrote:
Do you have any idea if the change back in the current WP was deliberate or an editing glitch? Also, does your "well sort of anyway" comment mean you think the current WP is unclear?
No it's a change of nuance in the text, sorry I wasn't clear, the WP is perfectly fine. John.

John Maddock <john <at> johnmaddock.co.uk> writes:
-tr1_is_base_of_test (http://tinyurl.com/2hzmae) is failing because Boost thinks is_base_of<int, int> should be true and VC9 says it's false. n2157 has the example "is_base_of<int, int>::value // false", so VC looks correct here.
Sigh... it depends, as far as TR1 is concerned this started out false, and then changed to true (in the final TR1 draft N1836 anyway). However, the std whitepaper has for the moment anyway changed it back again... well sort of anyway.
Just to follow this up - MS have confirmed that they consider 'false' to be the correct result here - see <http://tinyurl.com/2ne327>
participants (3)
-
Beman Dawes
-
John Maddock
-
Richard Webb