Fix explicit template parameter reporting for narrowing conversions
authorErich Keane <erich.keane@intel.com>
Mon, 7 May 2018 17:05:20 +0000 (17:05 +0000)
committerErich Keane <erich.keane@intel.com>
Mon, 7 May 2018 17:05:20 +0000 (17:05 +0000)
commitc90bb6d762da723ad41701fae82020b500332fc3
tree6615746b9f8818f2d7165307a05f8fcd5b10c81b
parent0412c902369d7e56b64d74e6f3895cb4636f9db7
Fix explicit template parameter reporting for narrowing conversions

I found that explicit template parameters that caused a
narrowing integer conversion resulted in the incorrect parameter
being mentioned in the note (see test attached). This is because
the argument checking code doesn't check to see if it caused
SFINAE errors when checking the arguments, so instead of giving
up on the first error, it continues through the list. This
makes the error reporting pick up the last template param every time.

This patch checks these parameters on each argument and gives up
if there is an error. The result is that only the required amount
of arguments are checked, and that the 'Converted' array contains
only the successful arguments before the first failure, as the
calls seem to all expect.

llvm-svn: 331651
clang/lib/Sema/SemaTemplate.cpp
clang/test/SemaTemplate/temp_arg_nontype_cxx11.cpp