public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/97523] New: [11 Regression] bogus "would use explicit constructor" error for new[]()
@ 2020-10-21 19:05 mpolacek at gcc dot gnu.org
  2020-10-21 19:05 ` [Bug c++/97523] " mpolacek at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2020-10-21 19:05 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 97523
           Summary: [11 Regression] bogus "would use explicit constructor"
                    error for new[]()
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: mpolacek at gcc dot gnu.org
  Target Milestone: ---

Since my r11-3092 the following is rejected with -std=c++20:

template <typename> struct A;
template <typename T> struct A<T[]> { typedef T type; };
template <typename T> using U = typename A<T>::type;

struct B {
  template <typename T> B(T);
};

long int sz;

template <typename T> void foo() { new U<T>[sz](); }

struct D {
  explicit D();
};

struct C {
  B b;
  C() : b(foo<D[]>) {}
};


r.cc: In instantiation of ‘void foo() [with T = D []]’:
r.cc:19:9:   required from here
r.cc:11:36: error: converting to ‘U<D []>’ {aka ‘D’} from initializer list
would use explicit constructor ‘D::D()’
   11 | template <typename T> void foo() { new U<T>[sz](); }
      |

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

end of thread, other threads:[~2020-11-19 19:02 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-21 19:05 [Bug c++/97523] New: [11 Regression] bogus "would use explicit constructor" error for new[]() mpolacek at gcc dot gnu.org
2020-10-21 19:05 ` [Bug c++/97523] " mpolacek at gcc dot gnu.org
2020-11-18 16:47 ` mpolacek at gcc dot gnu.org
2020-11-19 19:00 ` cvs-commit at gcc dot gnu.org
2020-11-19 19:02 ` mpolacek 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).