I just ran across some unexpected and frustrating behaviour while working on a C++ project. My actual code is a tad more complicated, but the following example captures it just
class Irritating
{
public: Irritating() {}
private: Irritating(const Irritating& other) {}
};
enum DefaultConstruct { defaultConstruct };
class MaybeTooClever
: public Irritating
{
public:
MaybeTooClever( DefaultConstruct = defaultConstruct ) {}
#ifdef __GNUC__
public:
MaybeTooClever( MaybeTooClever const& other ); // No such.
#else
private:
MaybeTooClever( MaybeTooClever const& other ); // No such.
#endif
};
static MaybeTooClever const array[] = { defaultConstruct };
int main()
{}