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

--- Comment #1 from Zavadovsky Yan <zavadovsky.yan at gmail dot com> ---
Got same bug with all GCC version since (at least, doesn't check older
versions) 6.3.0 and newer.

Code:
<code>
struct Base
{
        Base(void*) { }
        virtual ~Base() { }
};

template< typename... Ts > struct Derived : public Ts...
{
        template< typename... Us > Derived(Us... args) : Ts(args...)... { }
};

int main()
{
        Derived<Base> d((void*)0);
        return 0;
}
</code>

Clang++ compiles it.

GCC reports error:
<code>
test.cpp: In instantiation of ‘Derived<Ts>::Derived(Us ...) [with Us = {void*};
Ts = {Base}]’:
test.cpp:14:26:   required from here
test.cpp:9:62: error: no matching function for call to ‘Base::Base(bool)’
    9 |  template< typename... Us > Derived(Us... args) : Ts(args...)... { }
      |                                                              ^~~
test.cpp:3:2: note: candidate: ‘Base::Base(void*)’
    3 |  Base(void*) { }
      |  ^~~~
test.cpp:3:7: note:   no known conversion for argument 1 from ‘bool’ to ‘void*’
    3 |  Base(void*) { }
      |       ^~~~~
test.cpp:1:8: note: candidate: ‘constexpr Base::Base(const Base&)’
    1 | struct Base
      |        ^~~~
test.cpp:1:8: note:   no known conversion for argument 1 from ‘bool’ to ‘const
Base&’
</code>

Compilation command: g++ -std=c++14 -c test.cpp

GCC version:
<code>
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-redhat-linux/9/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-redhat-linux
Configured with: ../configure --enable-bootstrap
--enable-languages=c,c++,fortran,objc,obj-c++,ada,go,d,lto --prefix=/usr
--mandir=/usr/share/man --infodir=/usr/share/info
--with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-shared
--enable-threads=posix --enable-checking=release --enable-multilib
--with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions
--enable-gnu-unique-object --enable-linker-build-id
--with-gcc-major-version-only --with-linker-hash-style=gnu --enable-plugin
--enable-initfini-array --with-isl --enable-offload-targets=nvptx-none
--without-cuda-driver --enable-gnu-indirect-function --enable-cet
--with-tune=generic --with-arch_32=i686 --build=x86_64-redhat-linux
Thread model: posix
gcc version 9.2.1 20190827 (Red Hat 9.2.1-1) (GCC)
</code>

Reply via email to