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++/70845] [6/7 Regression] inherited piecewise_construct_t constructor from std::pair by "using-declarations" is missing


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

Ville Voutilainen <ville.voutilainen at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ville.voutilainen at gmail dot com

--- Comment #6 from Ville Voutilainen <ville.voutilainen at gmail dot com> ---
Here's a test snippet without library types. Clang accepts the code, gcc
rejects it.

template <class T>
struct holder
{
    T t;
};

template <class... Args> 
struct tuple_holder : holder<Args...>
{
    tuple_holder(Args&&... args) : holder<Args>{static_cast<Args&&>(args)}...
{}
    tuple_holder(const tuple_holder&) = default;
    tuple_holder(tuple_holder&&) = default;
};

template <class T, class U>
struct my_pair
{
    template <class... Args>
    my_pair(tuple_holder<Args...>) {}
    my_pair(const my_pair&) = default;
};

template <class T, class U>
struct my_real_pair : my_pair<T, U>
{
    using my_pair<T, U>::my_pair;
};

int main()
{
    my_real_pair<int, float>(tuple_holder<int&&>(1));
}

prog.cc: In constructor 'my_real_pair<int,
float>::my_real_pair(tuple_holder<Args ...>) [with Args = {int&&}]':
prog.cc:26:26: error: use of deleted function
'tuple_holder<Args>::tuple_holder(const tuple_holder<Args>&) [with Args =
{int&&}]'
     using my_pair<T, U>::my_pair;
                          ^~~~~~~
prog.cc:11:5: note: 'tuple_holder<Args>::tuple_holder(const
tuple_holder<Args>&) [with Args = {int&&}]' is implicitly deleted because the
default definition would be ill-formed:
     tuple_holder(const tuple_holder&) = default;
     ^~~~~~~~~~~~
prog.cc:11:5: error: use of deleted function 'holder<int&&>::holder(const
holder<int&&>&)'
prog.cc:2:8: note: 'holder<int&&>::holder(const holder<int&&>&)' is implicitly
deleted because the default definition would be ill-formed:
 struct holder
        ^~~~~~
prog.cc:2:8: error: copying non-static data member 'int&& holder<int&&>::t' of
rvalue reference type
prog.cc: In function 'int main()':
prog.cc:31:52: note: synthesized method 'my_real_pair<int,
float>::my_real_pair(tuple_holder<Args ...>) [with Args = {int&&}]' first
required here 
     my_real_pair<int, float>(tuple_holder<int&&>(1));
                                                    ^

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