Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8671763
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T19:01:54+00:00 2026-06-12T19:01:54+00:00

I have defaulted my copy constructor and copy assignment operator as follows: Config(const Config&

  • 0

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)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T19:01:56+00:00Added an answer on June 12, 2026 at 7:01 pm

    Just omit the parameters:

    Config(const Config&) = default;
    Config& operator=(const Config&) = default;
    

    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:

    … A function that is explicitly defaulted shall

    — be a special member function,

    — have the same declared function type (except for possibly differing ref-qualifiers and except that in the case of a copy constructor or copy assignment operator, the parameter type may be “reference to non-const T”, where T is the name of the member function’s class) as if it had been implicitly declared …

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a class that requires a non-default copy constructor and assignment operator (it
Do we have to explicitly define a default constructor when we define a copy
i have a Controls class that have default constructor and copy constructor and other
I know that the compiler sometimes provides a default copy constructor if you don't
I have a class with const members, and one constructor which calls another constructor
My server have default php version of 4, so when I run some script
I want to be able to have default text like Enter content here... appear
here's a tricky question... I have default styled input fields (no css added, just
I have some default values for testing my code, but for security reasons those
I have a default ListView that i have added my custom views for the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.