public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "enolan at alumni dot cmu.edu" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug libstdc++/112318] New: Deprecated move ctor does not trigger -Wdeprecated-declarations when creating a std::optional
Date: Tue, 31 Oct 2023 16:38:28 +0000	[thread overview]
Message-ID: <bug-112318-4@http.gcc.gnu.org/bugzilla/> (raw)

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

            Bug ID: 112318
           Summary: Deprecated move ctor does not trigger
                    -Wdeprecated-declarations when creating a
                    std::optional
           Product: gcc
           Version: 13.2.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: enolan at alumni dot cmu.edu
  Target Milestone: ---

When constructing a std::optional value for a type whose move ctor is marked
deprecated that invokes its move ctor, -Wdeprecated-declarations is not
triggered.

Compiler explorer link: https://godbolt.org/z/EPveeoEfn

Minimal reproduction:

#include <optional>

struct foo {
    foo() {}
    [[deprecated]] foo(foo&&);
};

void bar() {
    std::optional<foo> quux{foo{}};
}

> the exact version of gcc

g++ (GCC) 13.2.1 20231011 (Red Hat 13.2.1-4)

> the system type

Fedora release 38 (Thirty Eight)

> the options given when GCC was configured/built

Configured with: ../configure --enable-bootstrap
--enable-languages=c,c++,fortran,objc,obj-c++,ada,go,d,m2,lto --prefix=/usr
--mandir=/usr/share/man --infodir=/usr/share/info
--with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-shared
--enable-threads=posix --enable-checking=release --enable-multilib
--with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions
--enable-gnu-unique-object --enable-linker-build-id
--with-gcc-major-version-only --enable-libstdcxx-backtrace
--with-libstdcxx-zoneinfo=/usr/share/zoneinfo --with-linker-hash-style=gnu
--enable-plugin --enable-initfini-array
--with-isl=/builddir/build/BUILD/gcc-13.2.1-20231011/obj-x86_64-redhat-linux/isl-install
--enable-offload-targets=nvptx-none --without-cuda-driver
--enable-offload-defaulted --enable-gnu-indirect-function --enable-cet
--with-tune=generic --with-arch_32=i686 --build=x86_64-redhat-linux
--with-build-config=bootstrap-lto --enable-link-serialization=1

> the complete command line that triggers the bug

g++ -c -Werror=deprecated-declarations poc.cpp

> the compiler output

             reply	other threads:[~2023-10-31 16:38 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-31 16:38 enolan at alumni dot cmu.edu [this message]
2023-10-31 16:41 ` [Bug c++/112318] " pinskia at gcc dot gnu.org
2023-10-31 17:21 ` redi at gcc dot gnu.org
2023-10-31 17:29 ` redi at gcc dot gnu.org
2023-12-13 14:40 ` herring at lanl dot gov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-112318-4@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).