[Boost-bugs] [Boost C++ Libraries] #7934: tuples::element returns wrong typesss for bolatile tuples

Subject: [Boost-bugs] [Boost C++ Libraries] #7934: tuples::element returns wrong typesss for bolatile tuples
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2013-01-28 01:01:27


#7934: tuples::element returns wrong typesss for bolatile tuples
-------------------------------------+--------------------------------------
 Reporter: ptomulik@… | Owner: djowel
     Type: Bugs | Status: new
Milestone: To Be Determined | Component: tuple
  Version: Boost 1.52.0 | Severity: Problem
 Keywords: |
-------------------------------------+--------------------------------------
 Hi,

 according to c++11, volatile tuples should return volatile elements.
 I think, boost tuple should behave similarly, however it doesn't.

 Below is an example with two tests, one test for boost tuple and
 one for standard tuple. The boost tuple test fails.



 {{{
 // file a.cpp
 #define BOOST_TEST_MODULE example
 #include <boost/test/included/unit_test.hpp>
 #include <boost/type_traits.hpp>
 #include <boost/tuple/tuple.hpp>
 #include <tuple>

 BOOST_AUTO_TEST_CASE( boost_tuple )
 {
   using boost::is_same;
   using boost::tuple;
   using boost::tuples::element;
   typedef element<0, volatile tuple<int> > VElement;
   typedef element<0, const volatile tuple<int> > CVElement;
   BOOST_CHECK((is_same<typename VElement::type, volatile int>::value));
   BOOST_CHECK((is_same<typename CVElement::type, const volatile
 int>::value));
 }

 BOOST_AUTO_TEST_CASE( std_tuple )
 {
   using boost::is_same;
   using std::tuple;
   using std::tuple_element;
   typedef tuple_element<0, volatile tuple<int> > VElement;
   typedef tuple_element<0, const volatile tuple<int> > CVElement;
   BOOST_CHECK((is_same<typename VElement::type, volatile int>::value));
   BOOST_CHECK((is_same<typename CVElement::type, const volatile
 int>::value));
 }
 }}}


 {{{
 ptomulik_at_barakus$ g++ -ansi -std=c++11 -Werror -Wall -Wextra -pedantic
 a.cpp
 ptomulik_at_barakus$ ./a.out
 Running 2 test cases...
 a.cpp(15): error in "boost_tuple": check (is_same<typename VElement::type,
 volatile int>::value) failed
 a.cpp(16): error in "boost_tuple": check (is_same<typename
 CVElement::type, const volatile int>::value) failed

 *** 2 failures detected in test suite "example"
 }}}

 my gcc version

 {{{
 ptomulik_at_barakus:$ g++ --version
 g++ (Debian 4.7.2-5) 4.7.2
 Copyright (C) 2012 Free Software Foundation, Inc.
 This is free software; see the source for copying conditions. There is NO
 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR
 PURPOSE.
 }}}

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/7934>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:11 UTC