]> granicus.if.org Git - clang/commit
Warn when the conversion of an integral non-type template argument to
authorDouglas Gregor <dgregor@apple.com>
Thu, 25 Mar 2010 22:21:04 +0000 (22:21 +0000)
committerDouglas Gregor <dgregor@apple.com>
Thu, 25 Mar 2010 22:21:04 +0000 (22:21 +0000)
commit684d096c204c5eef29c10777bce890400d235d8c
treea7e3f7f7e3f10eecec39df906746c0aa8368e140
parenteab5d1eaaa662c849f1f9920dc8c6a31d7c32d47
Warn when the conversion of an integral non-type template argument to
the type of its corresponding non-type template parameter changes the
value. Previously, we were diagnosing this as an error, which was
wrong. We give reasonably nice warnings like:

test/SemaTemplate/temp_arg_nontype.cpp:100:10: warning: non-type template
      argument value '256' truncated to '0' for template parameter of type
      'unsigned char'
Overflow<256> *overflow3; // expected-warning{{non-type template ...
         ^~~
test/SemaTemplate/temp_arg_nontype.cpp:96:24: note: template parameter is
      declared here
template<unsigned char C> struct Overflow;
                       ^

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99561 91177308-0d34-0410-b5e6-96231b3b80d8
include/clang/Basic/DiagnosticSemaKinds.td
lib/Sema/SemaTemplate.cpp
test/CXX/temp/temp.fct.spec/temp.deduct/p9.cpp [new file with mode: 0644]
test/SemaTemplate/temp_arg_nontype.cpp