public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/101194] New: 7.2 Regression
@ 2021-06-24 13:43 yannick.lepennec+gcc at live dot fr
  2021-06-25  6:14 ` [Bug libstdc++/101194] [9/10/11/12 Regression] rguenth at gcc dot gnu.org
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: yannick.lepennec+gcc at live dot fr @ 2021-06-24 13:43 UTC (permalink / raw)
  To: gcc-bugs

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

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2022-05-27  9:05 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-24 13:43 [Bug c++/101194] New: 7.2 Regression yannick.lepennec+gcc at live dot fr
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

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