I have defaulted my copy constructor and copy assignment operator as follows:
Config(const Config& config) = default;
Config& operator=(const Config& rhs) = default;
and then have given access to these via friendship to a free standing function.
Upon creating a copy of a config object, I’m getting the following warning and note(?):
./cfg/config.hpp:129:3: warning: unused parameter ‘config’
[-Wunused-parameter] cfg/get.cpp: In function ‘const cfg::Config&
cfg::Get(bool)’: cfg/get.cpp:34:30: note: synthesized method
‘cfg::Config::Config(const cfg::Config&)’ first required here
It would appear the copy constructor isn’t even being instantiated.
Despite this, the code seems to run.
gcc version 4.6.3 (Ubuntu/Linaro 4.6.3-1ubuntu5)
Just omit the parameters:
The statements above instruct the compiler to generate default special member functions of the type stated, but the details of these implementations are not specified. The parameter names are redundant and have no effect. The compiler is free to issue warnings for legal code.
From §8.4.2: