[Bug c++/101988] New: Accepts invalid new-expression of array of deduced class template
ed at catmur dot uk
gcc-bugzilla@gcc.gnu.org
Thu Aug 19 21:41:42 GMT 2021
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)
More information about the Gcc-bugs
mailing list