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 libstdc++/71096] New: std::get did not work for nested derived classes from std::tuple if one element is empty


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

            Bug ID: 71096
           Summary: std::get did not work for nested derived classes from
                    std::tuple if one element is empty
           Product: gcc
           Version: 6.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: lts-rudolph at gmx dot de
  Target Milestone: ---

Created attachment 38482
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=38482&action=edit
minimum example to compile

If you derive from std::tuple and use this class nested, std::get fails if
there is a empty tuple inside the outside tuple.

Please see code for clarification :-)

#include <tuple>

template <typename... T>
struct TypeContainer : std::tuple<T...>
{
};

int main()
{
        std::get<0>(TypeContainer<TypeContainer<>>{});
}

Compile fails with:

/opt/linux-gnu_6.1.0/bin/g++ --std=c++14 main.cpp -O0 -g -o go 
main.cpp: In function 'int main()':
main.cpp:10:53: error: no matching function for call to
'get(TypeContainer<TypeContainer<> >)'
         std::get<0>(TypeContainer<TypeContainer<>>{});

...

/opt/linux-gnu_6.1.0/include/c++/6.1.0/tuple|1235 col 5| note:   template
argument deduction/substitution failed:
main.cpp|10 col 53| note:   'std::tuple<_Elements ...>' is an ambiguous base
class of 'TypeContainer<TypeContainer<> >'
||          std::get<0>(TypeContainer<TypeContainer<>>{});
||                                                      ^

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