Home | History | Annotate | Download | only in SemaTemplate
      1 // RUN: %clang_cc1 -fsyntax-only -verify %s
      2 
      3 namespace {
      4 template <bool, typename>
      5 void Foo() {}
      6 
      7 template <int size>
      8 void Foo() {
      9   int arr[size];
     10   // expected-error@-1 {{'arr' declared as an array with a negative size}}
     11 }
     12 }
     13 
     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>
     20 void Bar() {}
     21 
     22 template <int size>
     23 void Bar() {
     24   int arr[size];
     25   // expected-error@-1 {{'arr' declared as an array with a negative size}}
     26 }
     27 
     28 void test_bar() {
     29   Bar<-1>();
     30   // expected-note@-1 {{in instantiation of function template specialization 'Bar<-1>' requested here}}
     31 }
     32 
     33