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