xref: /minix3/external/bsd/llvm/dist/clang/test/SemaTemplate/overloaded-functions.cpp (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
1  // RUN: %clang_cc1 -fsyntax-only -verify %s
2  
3  namespace {
4  template <bool, typename>
Foo()5  void Foo() {}
6  
7  template <int size>
Foo()8  void Foo() {
9    int arr[size];
10    // expected-error@-1 {{'arr' declared as an array with a negative size}}
11  }
12  }
13  
test_foo()14  void test_foo() {
15    Foo<-1>();
16    // expected-note@-1 {{in instantiation of function template specialization '(anonymous namespace)::Foo<-1>' requested here}}
17  }
18  
19  template <bool, typename>
Bar()20  void Bar() {}
21  
22  template <int size>
Bar()23  void Bar() {
24    int arr[size];
25    // expected-error@-1 {{'arr' declared as an array with a negative size}}
26  }
27  
test_bar()28  void test_bar() {
29    Bar<-1>();
30    // expected-note@-1 {{in instantiation of function template specialization 'Bar<-1>' requested here}}
31  }
32  
33