[Boost-bugs] [Boost C++ Libraries] #11257: remove_cv does not work with references

Subject: [Boost-bugs] [Boost C++ Libraries] #11257: remove_cv does not work with references
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2015-04-30 15:47:46


#11257: remove_cv does not work with references
--------------------------+-------------------------
 Reporter: ncornu@… | Owner: johnmaddock
     Type: Bugs | Status: new
Milestone: | Component: type_traits
  Version: Boost 1.58.0 | Severity: Regression
 Keywords: |
--------------------------+-------------------------
 Hi o/

 I reproduce a little bug with remove_cv. When we got a reference,
 remove_cv does not work with const or volatile.

 The attached file, is a little file to show this.

 Here is the code:

 {{{
 #include <boost/type_traits/remove_cv.hpp>

 template<class U> struct look_deduction;

 typedef boost::remove_cv<const int&>::type int_ref;
 typedef boost::remove_cv<const int>::type int_notref;
 typedef boost::remove_cv<volatile int&>::type int_vol_ref;
 typedef boost::remove_cv<volatile int>::type int_vol_notref;

 look_deduction<int_ref> foo1;
 look_deduction<int_notref> foo2;
 look_deduction<int_vol_ref> foo3;
 look_deduction<int_vol_notref> foo4;
 }}}

 Here is the clang++ (v3.6.0) output:
 clang++ -c -std=c++11 (or -std=c++14 or -std=c++98)

 {{{
 main.cpp:10:25: error: implicit instantiation of undefined template
 'look_deduction<const int &>'
 look_deduction<int_ref> foo1;
                         ^
 main.cpp:3:26: note: template is declared here
 template<class U> struct look_deduction;
                          ^
 main.cpp:11:28: error: implicit instantiation of undefined template
 'look_deduction<int>'
 look_deduction<int_notref> foo2;
                            ^
 main.cpp:3:26: note: template is declared here
 template<class U> struct look_deduction;
                          ^
 main.cpp:12:29: error: implicit instantiation of undefined template
 'look_deduction<volatile int &>'
 look_deduction<int_vol_ref> foo3;
                             ^
 main.cpp:3:26: note: template is declared here
 template<class U> struct look_deduction;
                          ^
 main.cpp:13:32: error: implicit instantiation of undefined template
 'look_deduction<int>'
 look_deduction<int_vol_notref> foo4;
                                ^
 main.cpp:3:26: note: template is declared here
 template<class U> struct look_deduction;
                          ^
 4 errors generated.
 }}}

 In all cases, const or volatile are still here. Same error with gcc 4.9.2.

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/11257>
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:18 UTC