diff options
Diffstat (limited to 'test/SemaTemplate/overloaded-functions.cpp')
-rw-r--r-- | test/SemaTemplate/overloaded-functions.cpp | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/test/SemaTemplate/overloaded-functions.cpp b/test/SemaTemplate/overloaded-functions.cpp new file mode 100644 index 000000000000..26565753dd73 --- /dev/null +++ b/test/SemaTemplate/overloaded-functions.cpp @@ -0,0 +1,32 @@ +// RUN: %clang_cc1 -fsyntax-only -verify %s + +namespace { +template <bool, typename> +void Foo() {} + +template <int size> +void Foo() { + int arr[size]; + // expected-error@-1 {{'arr' declared as an array with a negative size}} +} +} + +void test_foo() { + Foo<-1>(); + // expected-note@-1 {{in instantiation of function template specialization '(anonymous namespace)::Foo<-1>' requested here}} +} + +template <bool, typename> +void Bar() {} + +template <int size> +void Bar() { + int arr[size]; + // expected-error@-1 {{'arr' declared as an array with a negative size}} +} + +void test_bar() { + Bar<-1>(); + // expected-note@-1 {{in instantiation of function template specialization 'Bar<-1>' requested here}} +} + |