This is the mail archive of the gcc-bugs@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]

[Bug c++/78358] New: [7 Regression] wrong types for std::typle decomposition


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78358

            Bug ID: 78358
           Summary: [7 Regression] wrong types for std::typle
                    decomposition
           Product: gcc
           Version: 7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: trippels at gcc dot gnu.org
  Target Milestone: ---

gcc uses rvalue references instead of the plain types.

markus@x4 tmp % cat strc.cpp
#include <iostream>
#include <tuple>

template <typename, typename> struct same_type;
template <typename T> struct same_type<T, T> {};

int main() {
  // std::tuple tuple(1, 'a', 2.3, true);
  auto tuple = std::make_tuple(1, 'a', 2.3, true);
  auto[i, c, d, b] = tuple;
  same_type<std::tuple_element<0, decltype(tuple)>::type, decltype(i)>{};
  same_type<decltype(i), int>{};
  same_type<decltype(c), char>{};
  same_type<decltype(d), double>{};
  same_type<decltype(b), bool>{};
  std::cout << std::boolalpha;
  std::cout << "i=" << i << " c=" << c << " d=" << d << " b=" << b << '\n';
}

markus@x4 tmp % clang++ -Wno-unused-value -stdlib=libc++ -std=c++1z strc.cpp
markus@x4 tmp % g++ -std=c++1z strc.cpp
strc.cpp: In function ‘int main()’:
strc.cpp:11:72: error: invalid use of incomplete type ‘struct same_type<int,
int&&>’
   same_type<std::tuple_element<0, decltype(tuple)>::type, decltype(i)>{};
                                                                        ^
strc.cpp:4:38: note: declaration of ‘struct same_type<int, int&&>’
 template <typename, typename> struct same_type;
                                      ^~~~~~~~~
strc.cpp:12:31: error: invalid use of incomplete type ‘struct same_type<int&&,
int>’
   same_type<decltype(i), int>{};
                               ^
strc.cpp:4:38: note: declaration of ‘struct same_type<int&&, int>’
 template <typename, typename> struct same_type;
                                      ^~~~~~~~~
strc.cpp:13:32: error: invalid use of incomplete type ‘struct same_type<char&&,
char>’
   same_type<decltype(c), char>{};
                                ^
strc.cpp:4:38: note: declaration of ‘struct same_type<char&&, char>’
 template <typename, typename> struct same_type;
                                      ^~~~~~~~~
strc.cpp:14:34: error: invalid use of incomplete type ‘struct
same_type<double&&, double>’
   same_type<decltype(d), double>{};
                                  ^
strc.cpp:4:38: note: declaration of ‘struct same_type<double&&, double>’
 template <typename, typename> struct same_type;
                                      ^~~~~~~~~
strc.cpp:15:32: error: invalid use of incomplete type ‘struct same_type<bool&&,
bool>’
   same_type<decltype(b), bool>{};
                                ^
strc.cpp:4:38: note: declaration of ‘struct same_type<bool&&, bool>’
 template <typename, typename> struct same_type;
                                      ^~~~~~~~~

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