I recently upgraded my Intel C++ compiler from v13.0.1 (aka 2013) to v14.0.0 (aka 2013 sp1). It looks as though the standard libraries that it uses have become more C++11 compliant. As part of that, std::locale::facet was changed from:
class locale::facet {
protected:
explicit facet (size_t refs = 0);
virtual ~facet();
private:
facet (const facet&); // not defined
void operator= (const facet&); // not defined
}
To:
class locale::facet {
protected:
explicit facet (size_t refs = 0);
virtual ~facet();
facet (const facet&) = delete;
void operator= (const facet&) = delete;
}
The key piece being the use of = delete
to make it non-copyable. (Thanks to http://www.cplusplus.com/reference/locale/locale/facet/ for that side-by-side comparison.)
However, boost/date_time/date_facet.hpp uses this:
class date_facet : public std::locale::facet {
That's unchanged in both boost v1.48.0 and v1.54.0 (the two that I have installed in my environment).
date_facet doesn't appear to declare any copy constructor or operator=
.
In my own code, I am using it to make class static constants to hold a time format. So in a header file I have this as part of a class definition:
static const boost::local_time::local_time_facet _MYFACET;
And in the matching source file I have this:
const boost::local_time::local_time_facet MyClass::_MYFACET = boost::local_time::local_time_facet("%Y/%m/%d %H:%M:%S.%f");
This code has worked for years and is unchanged.
Now, when I try to compile I get this error:
/usr/include/boost/date_time/date_facet.hpp(49): error #373: "std::locale::facet::facet(const std::locale::facet &)" (declared at line 409 of "/usr/include/c++/4.4.6/bits/locale_classes.h") is inaccessible
class date_facet : public std::locale::facet {
^
compilation aborted for MyFile.cpp (code 2)
Googling hasn't turned up anyone else talking about this problem, which makes me think that I'm just doing something stupid.
Anyone else encountered this?
Anyone have a solution?
My only idea is to explicitly add an = delete
declaration to date_facet. I'll try that and supply my own answer if it works. But I really have no idea. (Edit: this idea was a failure, so don't try it.)