Podchishchaeva, Mariya bcc881161a [clang] Emit an error if variable ends up with incomplete array type
This adds an error if variable with incomplete type has initializer with
incomplete type, so it is not possible to deduce array size from
initializer.

Fixes https://github.com/llvm/llvm-project/issues/37257

Reviewed By: aaron.ballman, shafik

Differential Revision: https://reviews.llvm.org/D158615
2023-08-29 06:50:32 -07:00

17 lines
370 B
C++

// RUN: %clang_cc1 -fsyntax-only -verify %s
template<class T>
T&& create();
template<class T, class... Args>
void test() {
T t(create<Args>()...); // expected-error{{variable has incomplete type 'int[]'}}
(void) t;
}
struct A;
int main() {
test<int[]>(); // expected-note {{in instantiation of function template specialization 'test<int[]>' requested here}}
}