[llvm-bugs] [Bug 52063] New: new[] with deduced size requires the type to be default-constructible
via llvm-bugs
llvm-bugs at lists.llvm.org
Mon Oct 4 04:01:58 PDT 2021
https://bugs.llvm.org/show_bug.cgi?id=52063
Bug ID: 52063
Summary: new[] with deduced size requires the type to be
default-constructible
Product: clang
Version: 12.0
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: -New Bugs
Assignee: unassignedclangbugs at nondot.org
Reporter: blckcat at inbox.ru
CC: htmldeveloper at gmail.com, llvm-bugs at lists.llvm.org,
neeilans at live.com, richard-llvm at metafoo.co.uk
Code:
struct A { A(int) {} };
int main() { new A[]{A(1),A(2),A(3)}; }
This produces following error:
error: no matching constructor for initialization of 'A'
note: candidate constructor not viable: requires 1 argument, but 0 were
provided
(more candidates explained here)
note: in implicit initialization of trailing array elements in
runtime-sized array new
Since the array size is known at compile-time, this looks like a bug. GCC &
MSVC accept this code.
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20211004/254f42c5/attachment.html>
More information about the llvm-bugs
mailing list