[Bug libstdc++/93923] New: [Regression 10] std::is_copy_constructible raises compilation error

laurent.stacul at gmail dot com gcc-bugzilla@gcc.gnu.org
Tue Feb 25 09:08:00 GMT 2020


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

            Bug ID: 93923
           Summary: [Regression 10] std::is_copy_constructible raises
                    compilation error
           Product: gcc
           Version: 10.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: laurent.stacul at gmail dot com
  Target Milestone: ---

Hello,

The following code does not compile anymore with gcc 10 although it works in
9.2, 9.2, 8.x.

#include <type_traits>
#include <initializer_list>

class A;

template<typename T>
struct  B {
    template<
        class... Args,
        std::enable_if_t<std::is_constructible<T, Args...>::value, int> = 0 >
    B(Args && ... args) {}

};

struct A {
    A(const B<A>& b) {}
};

int main(int argc, const char *argv[])
{
    static_assert(std::is_copy_constructible<A>::value);
    return 0;
}

Compiling with the HEAD of gcc 10 I have the following error:

$ g++ is_constructible.cpp                                                     
                                                                               
                         [jobs: 0][history: 5132]
In file included from is_constructible.cpp:1:
/remote/tools/Linux/2.6/1A/toolchain/x86_64-v20.0.10/include/c++/10.0.1/type_traits:
In instantiation of ‘struct std::is_constructible<A, const A&>’:
is_constructible.cpp:10:75:   required by substitution of ‘template<class ...
Args, typename std::enable_if<std::is_constructible<A, Args ...>::value,
int>::type <anonymous> > B<A>::B(Args&& ...) [with Args = {const A&}; typename
std::enable_if<std::is_constructible<A, Args ...>::value, int>::type
<anonymous> = <missing>]’
/remote/tools/Linux/2.6/1A/toolchain/x86_64-v20.0.10/include/c++/10.0.1/type_traits:901:30:
  required from ‘struct std::__is_constructible_impl<A, const A&>’
/remote/tools/Linux/2.6/1A/toolchain/x86_64-v20.0.10/include/c++/10.0.1/type_traits:930:12:
  required from ‘struct std::__is_copy_constructible_impl<A, true>’
/remote/tools/Linux/2.6/1A/toolchain/x86_64-v20.0.10/include/c++/10.0.1/type_traits:936:12:
  required from ‘struct std::is_copy_constructible<A>’
is_constructible.cpp:21:48:   required from here
/remote/tools/Linux/2.6/1A/toolchain/x86_64-v20.0.10/include/c++/10.0.1/type_traits:906:12:
error: invalid use of incomplete type ‘struct std::__is_constructible_impl<A,
const A&>’
  906 |     struct is_constructible
      |            ^~~~~~~~~~~~~~~~
/remote/tools/Linux/2.6/1A/toolchain/x86_64-v20.0.10/include/c++/10.0.1/type_traits:900:12:
note: declaration of ‘struct std::__is_constructible_impl<A, const A&>’
  900 |     struct __is_constructible_impl
      |            ^~~~~~~~~~~~~~~~~~~~~~~

This is true in any standard versions (-std=c/gnu++14, c/gnu++17, c/gnu++2a,
c++20).

System information

$ gcc --version
gcc (GCC) 10.0.1 20200220 (experimental)
Copyright (C) 2020 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

$ uname -a                                                                      
Linux ncerndobedev6196 4.12.14-95.45-default #1 SMP Wed Dec 11 13:09:13 UTC
2019 (12c8180) x86_64 x86_64 x86_64 GNU/Linux


More information about the Gcc-bugs mailing list