https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106213

            Bug ID: 106213
           Summary: -Werror=deprecated-copy-dtor does not trigger warning
                    and error
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: federico.kircheis at gmail dot com
  Target Milestone: ---

Consider

struct s{
    int* i;
    s();
    ~s(){ delete i;}
};


void bar(){
    s instance;
    s instance2 = instance;
}

This code compiles without warnings (gcc12) unless using
"-Wdeprecated-copy-dtor"

I would like it to be an error, so I've used "-Werror=deprecated-copy-dtor",
but
 * it does not trigger an error
 * it does not even trigger a warning(!!!)

The minimal example

https://godbolt.org/z/9b98Gsz1n

"-Werror -Wdeprecated-copy-dtor" works, but it might turn other warnings into
error, so it is not desirable.
Also the output of "-Werror -Wdeprecated-copy-dtor" mentions
"-Werror=deprecated-copy-dtor", so it should work.

A possible workaround is using "-Werror=deprecated-copy-dtor
-Wdeprecated-copy-dtor", but it should not be necessary.

Other flags, like Wreorder, works correclty: https://godbolt.org/z/zrr1GbK4K

As far as I've tested, "-Werror=deprecated-copy-dtor" never worked.

Reply via email to