[cfe-dev] clang and a class with non-copyable and non-assignable member

Edward Diener eldlistmailingz at tropicsoft.com
Sat Jan 17 08:06:38 PST 2015


I am using the latest clang built from source. I am seeing this situation:

class XXX { some_non_copyable_non_assignable_member_type member; }

An object of class XXX never gets copied or assigned (it's a singleton ) 
and yet clang is giving an errors of the form:

error: 'operator=' is a private member of 'some_non_assignable_member_type'.

and

error: field of type 'some_non_copyable_non_assignable_member_type' has 
private copy constructor

My understanding of C++ is that if a member of a class is non-copyable 
and non-assignable and an instance of that class is never copied or 
assigned it is not an error even if the compiler would be creating a 
default copy constructor and default assignment operator when the class 
does not have user-defined versions.

The command line options to the clang++.exe compiler are:

-c -x c++ -O0 -g -fno-inline -Wall -pedantic -g







More information about the cfe-dev mailing list