public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "yannick.lepennec+gcc at live dot fr" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/101194] New: 7.2 Regression
Date: Thu, 24 Jun 2021 13:43:20 +0000	[thread overview]
Message-ID: <bug-101194-4@http.gcc.gnu.org/bugzilla/> (raw)

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

            Bug ID: 101194
           Summary: 7.2 Regression
           Product: gcc
           Version: 7.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: yannick.lepennec+gcc at live dot fr
  Target Milestone: ---

Dear Maintainers,

Obligatory godbolt: https://godbolt.org/z/KnMnc7P57
Since GCC 7.2:

$ g++ -std=c++17 -Wall -Wextra -pedantic-errors

#include <array>

struct nodefault {
    nodefault(int) {}
};

int main() {
    std::array<nodefault, 1> arr1{ nodefault{1} }; // OK
    std::array<nodefault, 1> arr2{ arr1[0] }; // Error???
}

Gives:

main.cpp: In function 'int main()':
main.cpp:9:44: error: no matching function for call to 'nodefault::nodefault()'
     std::array<nodefault, 1> arr2{ arr1[0] }; // Error???
                                            ^
main.cpp:4:5: note: candidate: nodefault::nodefault(int)
     nodefault(int) {}
     ^~~~~~~~~
main.cpp:4:5: note:   candidate expects 1 argument, 0 provided
main.cpp:3:8: note: candidate: constexpr nodefault::nodefault(const nodefault&)
 struct nodefault {
        ^~~~~~~~~
main.cpp:3:8: note:   candidate expects 1 argument, 0 provided
main.cpp:3:8: note: candidate: constexpr nodefault::nodefault(nodefault&&)
main.cpp:3:8: note:   candidate expects 1 argument, 0 provided
main.cpp:9:44: error: no matching function for call to 'nodefault::nodefault()'
     std::array<nodefault, 1> arr2{ arr1[0] }; // Error???
                                            ^
main.cpp:4:5: note: candidate: nodefault::nodefault(int)
     nodefault(int) {}
     ^~~~~~~~~
main.cpp:4:5: note:   candidate expects 1 argument, 0 provided
main.cpp:3:8: note: candidate: constexpr nodefault::nodefault(const nodefault&)
 struct nodefault {
        ^~~~~~~~~
main.cpp:3:8: note:   candidate expects 1 argument, 0 provided
main.cpp:3:8: note: candidate: constexpr nodefault::nodefault(nodefault&&)
main.cpp:3:8: note:   candidate expects 1 argument, 0 provided
main.cpp:9:44: error: no matching function for call to 'nodefault::nodefault()'
     std::array<nodefault, 1> arr2{ arr1[0] }; // Error???
                                            ^
main.cpp:4:5: note: candidate: nodefault::nodefault(int)
     nodefault(int) {}
     ^~~~~~~~~
main.cpp:4:5: note:   candidate expects 1 argument, 0 provided
main.cpp:3:8: note: candidate: constexpr nodefault::nodefault(const nodefault&)
 struct nodefault {
        ^~~~~~~~~
main.cpp:3:8: note:   candidate expects 1 argument, 0 provided
main.cpp:3:8: note: candidate: constexpr nodefault::nodefault(nodefault&&)
main.cpp:3:8: note:   candidate expects 1 argument, 0 provided
main.cpp:9:44: error: no matching function for call to 'nodefault::nodefault()'
     std::array<nodefault, 1> arr2{ arr1[0] }; // Error???
                                            ^
main.cpp:4:5: note: candidate: nodefault::nodefault(int)
     nodefault(int) {}
     ^~~~~~~~~
main.cpp:4:5: note:   candidate expects 1 argument, 0 provided
main.cpp:3:8: note: candidate: constexpr nodefault::nodefault(const nodefault&)
 struct nodefault {
        ^~~~~~~~~
main.cpp:3:8: note:   candidate expects 1 argument, 0 provided
main.cpp:3:8: note: candidate: constexpr nodefault::nodefault(nodefault&&)
main.cpp:3:8: note:   candidate expects 1 argument, 0 provided
main.cpp:9:44: error: no matching function for call to 'nodefault::nodefault()'
     std::array<nodefault, 1> arr2{ arr1[0] }; // Error???
                                            ^
main.cpp:4:5: note: candidate: nodefault::nodefault(int)
     nodefault(int) {}
     ^~~~~~~~~
main.cpp:4:5: note:   candidate expects 1 argument, 0 provided
main.cpp:3:8: note: candidate: constexpr nodefault::nodefault(const nodefault&)
 struct nodefault {
        ^~~~~~~~~
main.cpp:3:8: note:   candidate expects 1 argument, 0 provided
main.cpp:3:8: note: candidate: constexpr nodefault::nodefault(nodefault&&)
main.cpp:3:8: note:   candidate expects 1 argument, 0 provided
main.cpp:9:44: error: no matching function for call to 'nodefault::nodefault()'
     std::array<nodefault, 1> arr2{ arr1[0] }; // Error???
                                            ^
main.cpp:4:5: note: candidate: nodefault::nodefault(int)
     nodefault(int) {}
     ^~~~~~~~~
main.cpp:4:5: note:   candidate expects 1 argument, 0 provided
main.cpp:3:8: note: candidate: constexpr nodefault::nodefault(const nodefault&)
 struct nodefault {
        ^~~~~~~~~
main.cpp:3:8: note:   candidate expects 1 argument, 0 provided
main.cpp:3:8: note: candidate: constexpr nodefault::nodefault(nodefault&&)
main.cpp:3:8: note:   candidate expects 1 argument, 0 provided

---

GCC 7.2 and above accept the same code with -std=c++14. GCC 7.1 accepts it with
either. The error message seems to have gotten shorter in more recent GCC, but
is still present. I have bisected this to
https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff;h=0634d9fe36e8ced1c6046759f9ce1d2655c8d731

             reply	other threads:[~2021-06-24 13:43 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-24 13:43 yannick.lepennec+gcc at live dot fr [this message]
2021-06-25  6:14 ` [Bug libstdc++/101194] [9/10/11/12 Regression] rguenth at gcc dot gnu.org
2021-06-25  6:50 ` [Bug c++/101194] [9/10/11/12 Regression] aggregate init requires default constructor marxin at gcc dot gnu.org
2021-06-25  6:50 ` marxin at gcc dot gnu.org
2021-06-25 20:17 ` ppalka at gcc dot gnu.org
2021-06-28 20:21 ` ppalka at gcc dot gnu.org
2021-07-01  0:45 ` cvs-commit at gcc dot gnu.org
2021-07-13 14:03 ` cvs-commit at gcc dot gnu.org
2021-07-13 14:07 ` [Bug c++/101194] [9/10 " ppalka at gcc dot gnu.org
2022-05-11 17:25 ` cvs-commit at gcc dot gnu.org
2022-05-27  9:05 ` [Bug c++/101194] [9 " rguenth 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-101194-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).