brintos

brintos / llvm-project-archived public Read only

0
0
Text · 696 B · 2656575 Raw
33 lines · cpp
1// RUN: %clang_cc1 -fsyntax-only -verify %s2 3namespace {4template <bool, typename>5void Foo() {}6 7template <int size>8void Foo() {9  int arr[size];10  // expected-error@-1 {{'arr' declared as an array with a negative size}}11}12}13 14void test_foo() {15  Foo<-1>();16  // expected-note@-1 {{in instantiation of function template specialization '(anonymous namespace)::Foo<-1>' requested here}}17}18 19template <bool, typename>20void Bar() {}21 22template <int size>23void Bar() {24  int arr[size];25  // expected-error@-1 {{'arr' declared as an array with a negative size}}26}27 28void test_bar() {29  Bar<-1>();30  // expected-note@-1 {{in instantiation of function template specialization 'Bar<-1>' requested here}}31}32 33