public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/101988] New: Accepts invalid new-expression of array of deduced class template
@ 2021-08-19 21:41 ed at catmur dot uk
  2021-08-19 22:52 ` [Bug c++/101988] [12 Regression] " pinskia at gcc dot gnu.org
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: ed at catmur dot uk @ 2021-08-19 21:41 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 101988
           Summary: Accepts invalid new-expression of array of deduced
                    class template
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ed at catmur dot uk
  Target Milestone: ---

template<class T> struct A { A(T); };
auto p = new A[]{1};

g++
(Compiler-Explorer-Build-gcc-f0fca213bc52644ba896da622b35842a6157bd98-binutils-2.36.1)
12.0.0 20210818 (experimental) accepts (it allocates and constructs a single
`A<int>`.

gcc 11.2 and below rejects, correctly: error: creating array of 'A<...auto...>'

Per [expr.new]/2 the invented declaration should be:
A[] x{1};
which is ill-formed.

nb. clang ICEs on this (https://bugs.llvm.org/show_bug.cgi?id=51547)

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

end of thread, other threads:[~2022-01-27 13:25 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-19 21:41 [Bug c++/101988] New: Accepts invalid new-expression of array of deduced class template ed at catmur dot uk
2021-08-19 22:52 ` [Bug c++/101988] [12 Regression] " pinskia at gcc dot gnu.org
2021-08-19 22:56 ` pinskia at gcc dot gnu.org
2021-08-19 23:01 ` pinskia at gcc dot gnu.org
2021-08-19 23:11 ` pinskia at gcc dot gnu.org
2021-08-20  9:03 ` redi at gcc dot gnu.org
2021-08-20 13:57 ` mpolacek at gcc dot gnu.org
2022-01-20 10:49 ` rguenth at gcc dot gnu.org
2022-01-27 13:23 ` cvs-commit at gcc dot gnu.org
2022-01-27 13:25 ` 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).