This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/63339] New: "using constructors" from virtual bases are implicitly deleted
- From: "jobnoorman at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 23 Sep 2014 06:47:41 +0000
- Subject: [Bug c++/63339] New: "using constructors" from virtual bases are implicitly deleted
- Auto-submitted: auto-generated
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63339
Bug ID: 63339
Summary: "using constructors" from virtual bases are implicitly
deleted
Product: gcc
Version: 4.9.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: jobnoorman at gmail dot com
GCC implicitly deletes constructors pulled from a virtual base class with a
"using" directive. The error indicates GCC thinks the default definition would
be ill-formed.
Although I'm not completely sure this is a bug, I'm filing it as such since a
quick skim through section 7.3.4 and 12.9 of N3337 revealed no reason why
"using" a constructor from a virtual base should be disallowed. Also, Clang
compiles the example code just fine.
Here is a small piece of code that reproduces this issue:
struct A
{
A(int i) {}
};
struct B : virtual A
{
using A::A;
};
void f()
{
B b{5};
}
And the error produced by GCC:
$ g++-4.9 -c -std=c++11 test.cpp
test.cpp: In function âvoid f()â:
test.cpp:13:10: error: use of deleted function âB::B(int)â
B b{5};
^
test.cpp:8:14: note: âB::B(int)â is implicitly deleted because the default
definition would be ill-formed:
using A::A;
^
test.cpp:8:14: error: no matching function for call to âA::A()â
test.cpp:8:14: note: candidates are:
test.cpp:3:5: note: A::A(int)
A(int i) {}
^
test.cpp:3:5: note: candidate expects 1 argument, 0 provided
test.cpp:1:8: note: constexpr A::A(const A&)
struct A
^
test.cpp:1:8: note: candidate expects 1 argument, 0 provided
test.cpp:1:8: note: constexpr A::A(A&&)
test.cpp:1:8: note: candidate expects 1 argument, 0 provided
Further information:
$ g++-4.9 -v
Using built-in specs.
COLLECT_GCC=g++-4.9
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/4.9/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu
4.9.1-3ubuntu2~14.04.1' --with-bugurl=file:///usr/share/doc/gcc-4.9/README.Bugs
--enable-languages=c,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr
--program-suffix=-4.9 --enable-shared --enable-linker-build-id
--libexecdir=/usr/lib --without-included-gettext --enable-threads=posix
--with-gxx-include-dir=/usr/include/c++/4.9 --libdir=/usr/lib --enable-nls
--with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug
--enable-libstdcxx-time=yes --enable-gnu-unique-object --disable-vtable-verify
--enable-plugin --with-system-zlib --disable-browser-plugin
--enable-java-awt=gtk --enable-gtk-cairo
--with-java-home=/usr/lib/jvm/java-1.5.0-gcj-4.9-amd64/jre --enable-java-home
--with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-4.9-amd64
--with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-4.9-amd64
--with-arch-directory=amd64 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar
--enable-objc-gc --enable-multiarch --disable-werror --with-arch-32=i686
--with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib
--with-tune=generic --enable-checking=release --build=x86_64-linux-gnu
--host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 4.9.1 (Ubuntu 4.9.1-3ubuntu2~14.04.1)