public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "de34 at live dot cn" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug libstdc++/111511] New: Incorrect ADL in std::to_array in GCC 11/12/13
Date: Thu, 21 Sep 2023 06:17:13 +0000	[thread overview]
Message-ID: <bug-111511-4@http.gcc.gnu.org/bugzilla/> (raw)

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

            Bug ID: 111511
           Summary: Incorrect ADL in std::to_array in GCC 11/12/13
           Product: gcc
           Version: 13.2.1
            Status: UNCONFIRMED
          Keywords: rejects-valid
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: de34 at live dot cn
  Target Milestone: ---

The following program is incorrectly rejected when using libstdc++
(https://godbolt.org/z/x6K6r5svM).

```
#include <array>
#include <utility>

struct incomplete;

template<class T>
struct holder {
    T t;
};

using validator = holder<incomplete>*;

int main()
{
    validator a[1]{};
    (void) std::to_array(a);
    (void) std::to_array(std::move(a));
}
```

The error is caused by aunqualified calls to the `__to_array` internal
function, which triggers ADL for `incomplete` and requires it to be complete.

Not sure whether this should be WONTFIX since the implementation is
fundamentally changed in GCC 14 (PR 110167).

             reply	other threads:[~2023-09-21  6:17 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-21  6:17 de34 at live dot cn [this message]
2023-09-21  8:03 ` [Bug libstdc++/111511] " redi at gcc dot gnu.org
2023-09-21 10:33 ` m.cencora at gmail dot com
2023-09-21 10:42 ` redi at gcc dot gnu.org
2023-09-21 10:45 ` m.cencora at gmail dot com
2023-09-21 11:37 ` de34 at live dot cn
2023-09-25  8:53 ` cvs-commit at gcc dot gnu.org
2023-09-26 20:15 ` cvs-commit at gcc dot gnu.org
2023-09-26 22:55 ` cvs-commit at gcc dot gnu.org
2023-09-27 16:21 ` cvs-commit at gcc dot gnu.org
2023-09-27 16:23 ` redi at gcc dot gnu.org

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-111511-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).