This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: std::get not returning const rvalue reference from const rvalue reference of tuple


On 9 May 2018 at 22:10, Tim wrote:
> but I was expecting the last line of output to be "double const&&" because
> the following overload of std::get:
>
> template< std::size_t I, class... Types >
> constexpr std::tuple_element_t<I, tuple<Types...> >const&&
>     get( const tuple<Types...>&& t ) noexcept;
>
> What am I missing here? I'm using gcc 7.3.0 and the above code is compiled
> using "-std=c++17"

The overload you show above was only added to the standard quite
recently, and is not implemented in GCC 7.3 (nobody ever claimed that
C++17 support is complete in GCC 7.3).

It was added by https://cplusplus.github.io/LWG/issue2485

If you use GCC 8.1 you get the result you expect.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]