summaryrefslogtreecommitdiff
path: root/test/SemaTemplate/temp_arg_nontype.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2009-03-14 00:20:21 +0000
committerDouglas Gregor <dgregor@apple.com>2009-03-14 00:20:21 +0000
commitf80a9d5c2ccc465211178223799217f7a42774ae (patch)
treea313c405cc7b46ac61c77754b24aa677b66aecc6 /test/SemaTemplate/temp_arg_nontype.cpp
parent8af2c16571f3aade6d47ce81fa3857d01d375719 (diff)
downloadclang-f80a9d5c2ccc465211178223799217f7a42774ae.tar.gz
clang-f80a9d5c2ccc465211178223799217f7a42774ae.tar.bz2
clang-f80a9d5c2ccc465211178223799217f7a42774ae.tar.xz
Check for overflow and signedness problems with template
arguments. Eliminates a FIXME. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66993 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/SemaTemplate/temp_arg_nontype.cpp')
-rw-r--r--test/SemaTemplate/temp_arg_nontype.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/test/SemaTemplate/temp_arg_nontype.cpp b/test/SemaTemplate/temp_arg_nontype.cpp
index 55815fce1f..381947269e 100644
--- a/test/SemaTemplate/temp_arg_nontype.cpp
+++ b/test/SemaTemplate/temp_arg_nontype.cpp
@@ -102,3 +102,13 @@ A7<&Z::int_member> *a18_1;
A7c<&Z::int_member> *a18_2;
A7<&Z::float_member> *a18_3; // expected-error{{non-type template argument of type 'float struct Z::*' cannot be converted to a value of type 'int struct Z::*'}}
A7c<(&Z::int_member)> *a18_3; // expected-error{{non-type template argument cannot be surrounded by parentheses}}
+
+template<unsigned char C> struct Overflow; // expected-note{{template parameter is declared here}}
+
+Overflow<5> *overflow1; // okay
+Overflow<256> *overflow2; // expected-error{{non-type template argument value '256' is too large for template parameter of type 'unsigned char'}}
+
+
+template<unsigned> struct Signedness; // expected-note{{template parameter is declared here}}
+Signedness<10> *signedness1; // okay
+Signedness<-10> *signedness2; // expected-error{{non-type template argument provides negative value '-10' for unsigned template parameter of type 'unsigned int'}}