[iterator][type_traits] A test is failing with gcc in c++03 mode

The zip_iterator_test_std_pair is failing with gcc in c++-03 mode. The
problem reduces viqa Boost type traits to the fact that in gcc c++03
mode the expression:
__is_abstract(std::pair

Hi Edward,
Hmm, I can take a look later today. Which version of gcc is this with?
Thanks
On Dec 16, 2016 10:03 PM, "Edward Diener"
The zip_iterator_test_std_pair is failing with gcc in c++-03 mode. The problem reduces viqa Boost type traits to the fact that in gcc c++03 mode the expression:
__is_abstract(std::pair
) where __is_abstract is a compiler intrinsic, gives an error of:
error: forming reference to reference type 'std::__cxx11::basic_string<ch ar>&' pair(const _T1& __a, const _T2& __b) ^~~~
Is this a valid error according to the C++ 2003 standard ?
The test works in c++11 or c++14 mode.
_______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman /listinfo.cgi/boost

On 12/17/2016 11:32 AM, Nathan Wilson wrote:
Hi Edward,
Hmm, I can take a look later today. Which version of gcc is this with?
I am using mingw-64/gcc-6.2 on Windows. I will try it on Linux soon. If I use -std=gnu++03 instead of -std=c++03, it works without errors.
Thanks
On Dec 16, 2016 10:03 PM, "Edward Diener"
wrote: The zip_iterator_test_std_pair is failing with gcc in c++-03 mode. The problem reduces viqa Boost type traits to the fact that in gcc c++03 mode the expression:
__is_abstract(std::pair
) where __is_abstract is a compiler intrinsic, gives an error of:
error: forming reference to reference type 'std::__cxx11::basic_string<ch ar>&' pair(const _T1& __a, const _T2& __b) ^~~~
Is this a valid error according to the C++ 2003 standard ?
The test works in c++11 or c++14 mode.

Edward Diener wrote:
The zip_iterator_test_std_pair is failing with gcc in c++-03 mode. The problem reduces viqa Boost type traits to the fact that in gcc c++03 mode the expression:
__is_abstract(std::pair
) where __is_abstract is a compiler intrinsic, gives an error of:
error: forming reference to reference type 'std::__cxx11::basic_string<char>&' pair(const _T1& __a, const _T2& __b) ^~~~
Is this a valid error according to the C++ 2003 standard ?
References to references were invalid in C++98, but were made conditionally valid in C++03 by http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#106 However, __is_abstract is nonstandard, so who knows what it does. It might be worth trying -std=gnu++03 instead of -std=c++03.

On 12/17/2016 11:45 AM, Peter Dimov wrote:
Edward Diener wrote:
The zip_iterator_test_std_pair is failing with gcc in c++-03 mode. The problem reduces viqa Boost type traits to the fact that in gcc c++03 mode the expression:
__is_abstract(std::pair
) where __is_abstract is a compiler intrinsic, gives an error of:
error: forming reference to reference type 'std::__cxx11::basic_string<char>&' pair(const _T1& __a, const _T2& __b) ^~~~
Is this a valid error according to the C++ 2003 standard ?
References to references were invalid in C++98, but were made conditionally valid in C++03 by
http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#106
However, __is_abstract is nonstandard, so who knows what it does. It might be worth trying -std=gnu++03 instead of -std=c++03.
Your suggestion worked brilliantly. With -std=gnu++03 references to references are fine. However it looks like zip_iterator may need to be changed so that if references to references are not supported it should not be used. I did not write or update zip_iterator; Kohei Takahashi did the work of updating it.

Edward Diener wrote:
Your suggestion worked brilliantly. With -std=gnu++03 references to references are fine. However it looks like zip_iterator may need to be changed so that if references to references are not supported it should not be used. I did not write or update zip_iterator; Kohei Takahashi did the work of updating it.
It's not us forming the reference to reference, it's the __is_abstract intrinsic, so that's arguably a bug in the compiler. There's something odd in your error message though.
error: forming reference to reference type 'std::__cxx11::basic_string<char>&' pair(const _T1& __a, const _T2& __b) ^~~~
__cxx11 looks C++11 specific, and in -std=c++03 mode std::string shouldn't contain C++11 things, so there could be something else going wrong here.

On 12/17/2016 12:31 PM, Peter Dimov wrote:
Edward Diener wrote:
Your suggestion worked brilliantly. With -std=gnu++03 references to references are fine. However it looks like zip_iterator may need to be changed so that if references to references are not supported it should not be used. I did not write or update zip_iterator; Kohei Takahashi did the work of updating it.
It's not us forming the reference to reference, it's the __is_abstract intrinsic, so that's arguably a bug in the compiler.
There's something odd in your error message though.
error: forming reference to reference type 'std::__cxx11::basic_string<char>&' pair(const _T1& __a, const _T2& __b) ^~~~
__cxx11 looks C++11 specific, and in -std=c++03 mode std::string shouldn't contain C++11 things, so there could be something else going wrong here.
I asked about the __cxx11 and was told it is not C++11 specific but has to do with the dual ABI controlled by the _GLIBCXX_USE_CXX11_ABI macro. I should probably set that macro to 0 for less than c++11 compilation nonetheless.

On 17/12/2016 16:45, Peter Dimov wrote:
Edward Diener wrote:
The zip_iterator_test_std_pair is failing with gcc in c++-03 mode. The problem reduces viqa Boost type traits to the fact that in gcc c++03 mode the expression:
__is_abstract(std::pair
) where __is_abstract is a compiler intrinsic, gives an error of:
error: forming reference to reference type 'std::__cxx11::basic_string<char>&' pair(const _T1& __a, const _T2& __b) ^~~~
Is this a valid error according to the C++ 2003 standard ?
References to references were invalid in C++98, but were made conditionally valid in C++03 by
http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#106
However, __is_abstract is nonstandard, so who knows what it does. It might be worth trying -std=gnu++03 instead of -std=c++03.
I think the issue here is that you are calling
__is_abstract(malformed_type) - so when the compiler instantiates
std::pair

On 12/17/2016 1:19 PM, John Maddock wrote:
On 17/12/2016 16:45, Peter Dimov wrote:
Edward Diener wrote:
The zip_iterator_test_std_pair is failing with gcc in c++-03 mode. The problem reduces viqa Boost type traits to the fact tha
participants (4)
-
Edward Diener
-
John Maddock
-
Nathan Wilson
-
Peter Dimov