llvm-project/clang/test/SemaCXX/new-delete-array.cpp
Aaron Ballman 5b949a649a Fix crash when diagnosing a CTAD failure in an array new expression
This appears to be a think-o where the developer was trying to check for a null
pointer but was actually checking (redundantly) whether the optional held a
valid value or not. We now properly check the pointer for null.

This fixes PR51547.
2021-10-18 14:01:55 -04:00

10 lines
414 B
C++

// RUN: %clang_cc1 -fsyntax-only -std=c++17 %s -verify=cxx17
// RUN: %clang_cc1 -fsyntax-only -std=c++14 %s -verify=cxx14
namespace PR51547 {
template<class> struct A; // cxx14-note {{template is declared here}}
auto p = new A[]{}; // cxx14-error {{use of class template 'A' requires template arguments}} \
cxx17-error {{cannot form array of deduced class template specialization type}}
}