[Bug c++/63540] New: Erroneous "'Derived' declares a move constructor or move assignment operator" in error.
brooks at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Wed Oct 15 02:31:00 GMT 2014
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63540
Bug ID: 63540
Summary: Erroneous "'Derived' declares a move constructor or
move assignment operator" in error.
Product: gcc
Version: 4.9.2
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: brooks at gcc dot gnu.org
Consider the following reduced testcase:
----
template <typename T, typename = decltype(*static_cast<T*>(0) = 0)> int
break_it();
template <typename> int break_it();
struct Base {
Base(const Base &);
void operator=(Base &&);
};
struct Derived : Base {
using Base::operator=;
};
int a = break_it<Derived>();
Derived v(v);
----
With a recent 4.9, it fails with an erroneous error:
----
$ gcc-archive/4.9/215880/bin/g++ --std=gnu++11 t.cc -c -o t.o
t.cc:13:12: error: use of deleted function ‘Derived::Derived(const Derived&)’
Derived v(v);
^
t.cc:8:8: note: ‘Derived::Derived(const Derived&)’ is implicitly declared as
deleted because ‘Derived’ declares a move constructor or move assignment
operator
struct Derived : Base {
^
----
The same erroneous error occurs on trunk.
The call to 'Derived::operator=' in a SFINAE context within break_it seems to
be confusing GCC about which special members Derived declares.
More information about the Gcc-bugs
mailing list