xref: /llvm-project/clang/test/Sema/array-parameter.cpp (revision 66fa2847a775dda27ddcac3832769441727db42f)
1cc5b7727Sserge-sans-paille // RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -fsyntax-only -Warray-parameter -verify %s
2cc5b7727Sserge-sans-paille 
3cc5b7727Sserge-sans-paille template <int N>
4cc5b7727Sserge-sans-paille void func(int i[10]); // expected-note {{previously declared as 'int[10]' here}}
5cc5b7727Sserge-sans-paille 
6cc5b7727Sserge-sans-paille template <int N>
7cc5b7727Sserge-sans-paille void func(int i[N]); // expected-warning {{argument 'i' of type 'int[N]' with mismatched bound}}
8cc5b7727Sserge-sans-paille 
9cc5b7727Sserge-sans-paille template <int N>
10cc5b7727Sserge-sans-paille void func(int (&Val)[N]);
11cc5b7727Sserge-sans-paille 
12cc5b7727Sserge-sans-paille template <>
func(int (& Val)[10])13cc5b7727Sserge-sans-paille void func<10>(int (&Val)[10]) {
14cc5b7727Sserge-sans-paille }
15cc5b7727Sserge-sans-paille 
16cc5b7727Sserge-sans-paille static constexpr int Extent = 10;
17cc5b7727Sserge-sans-paille void funk(int i[10]);
18cc5b7727Sserge-sans-paille void funk(int i[Extent]); // no-warning
19*66fa2847Sserge-sans-paille 
20*66fa2847Sserge-sans-paille template<int K>
21*66fa2847Sserge-sans-paille struct T {
22*66fa2847Sserge-sans-paille   static void F(int a[8 * K]);
23*66fa2847Sserge-sans-paille };
24*66fa2847Sserge-sans-paille template<int K>
F(int a[8* K])25*66fa2847Sserge-sans-paille void T<K>::F(int a[8 * K]) {} // no-warning
26