diff options
author | Douglas Gregor <dgregor@apple.com> | 2010-03-26 02:38:37 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2010-03-26 02:38:37 +0000 |
commit | 1a6e03457ebafd6ac523cdcf5d6b6f411ea08772 (patch) | |
tree | 6823501bcfb35b2b780491276302e560d4ec6641 /test/SemaTemplate/temp_arg_nontype.cpp | |
parent | d7e29e114d20da5b83e0cb7bc29ec717a7458cb1 (diff) | |
download | clang-1a6e03457ebafd6ac523cdcf5d6b6f411ea08772.tar.gz clang-1a6e03457ebafd6ac523cdcf5d6b6f411ea08772.tar.bz2 clang-1a6e03457ebafd6ac523cdcf5d6b6f411ea08772.tar.xz |
Reinstate change to non-type template arguments of integral type, so
that we extend/truncate then correct the sign to convert the non-type
template argument to the template parameter's type. Previously, we
reported an error when the non-type template argument was out of
range; now we just warn.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99600 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/SemaTemplate/temp_arg_nontype.cpp')
-rw-r--r-- | test/SemaTemplate/temp_arg_nontype.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/test/SemaTemplate/temp_arg_nontype.cpp b/test/SemaTemplate/temp_arg_nontype.cpp index 9c20f2a0eb..d077a35930 100644 --- a/test/SemaTemplate/temp_arg_nontype.cpp +++ b/test/SemaTemplate/temp_arg_nontype.cpp @@ -97,21 +97,21 @@ template<unsigned char C> struct Overflow; // expected-note{{template parameter Overflow<5> *overflow1; // okay Overflow<255> *overflow2; // okay -Overflow<256> *overflow3; // expected-error{{non-type template argument value '256' is too large for template parameter of type 'unsigned char'}} +Overflow<256> *overflow3; // expected-warning{{non-type template argument value '256' truncated to '0' 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'}} +Signedness<-10> *signedness2; // expected-warning{{non-type template argument with value '-10' converted to '4294967286' for unsigned template parameter of type 'unsigned int'}} template<signed char C> struct SignedOverflow; // expected-note 3 {{template parameter is declared here}} SignedOverflow<1> *signedoverflow1; SignedOverflow<-1> *signedoverflow2; SignedOverflow<-128> *signedoverflow3; -SignedOverflow<-129> *signedoverflow4; // expected-error{{non-type template argument value '-129' is too large for template parameter of type 'signed char'}} +SignedOverflow<-129> *signedoverflow4; // expected-warning{{non-type template argument value '-129' truncated to '127' for template parameter of type 'signed char'}} SignedOverflow<127> *signedoverflow5; -SignedOverflow<128> *signedoverflow6; // expected-error{{non-type template argument value '128' is too large for template parameter of type 'signed char'}} -SignedOverflow<(unsigned char)128> *signedoverflow7; // expected-error{{non-type template argument value '128' is too large for template parameter of type 'signed char'}} +SignedOverflow<128> *signedoverflow6; // expected-warning{{non-type template argument value '128' truncated to '-128' for template parameter of type 'signed char'}} +SignedOverflow<(unsigned char)128> *signedoverflow7; // expected-warning{{non-type template argument value '128' truncated to '-128' for template parameter of type 'signed char'}} // Check canonicalization of template arguments. template<int (*)(int, int)> struct FuncPtr0; |