summaryrefslogtreecommitdiff
path: root/test/SemaTemplate/temp_arg_nontype.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2010-03-28 02:42:43 +0000
committerDouglas Gregor <dgregor@apple.com>2010-03-28 02:42:43 +0000
commit02024a9f0d8e6c898de276193af604c42ee41269 (patch)
tree724000d246bc55615fb8dac08f93125f3f45e75d /test/SemaTemplate/temp_arg_nontype.cpp
parent5e2d2c2ee3cf410643e0f9a5701708e51409d973 (diff)
downloadclang-02024a9f0d8e6c898de276193af604c42ee41269.tar.gz
clang-02024a9f0d8e6c898de276193af604c42ee41269.tar.bz2
clang-02024a9f0d8e6c898de276193af604c42ee41269.tar.xz
After performing template argument deduction for a function template,
check deduced non-type template arguments and template template arguments against the template parameters for which they were deduced, performing conversions as appropriate so that deduced template arguments get the same treatment as explicitly-specified template arguments. This is the bulk of PR6723. Also keep track of whether deduction of a non-type template argument came from an array bound (vs. anywhere else). With this information, we enforce C++ [temp.deduct.type]p17, which requires exact type matches when deduction deduces a non-type template argument from something that is not an array bound. Finally, when in a SFINAE context, translate the "zero sized arrays are an extension" extension diagnostic into a hard error (for better standard conformance), which was a minor part of PR6723. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99734 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/SemaTemplate/temp_arg_nontype.cpp')
-rw-r--r--test/SemaTemplate/temp_arg_nontype.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/test/SemaTemplate/temp_arg_nontype.cpp b/test/SemaTemplate/temp_arg_nontype.cpp
index d077a35930..51e12e994c 100644
--- a/test/SemaTemplate/temp_arg_nontype.cpp
+++ b/test/SemaTemplate/temp_arg_nontype.cpp
@@ -171,3 +171,12 @@ namespace pr6249 {
int h();
template int f<int, h>();
}
+
+namespace PR6723 {
+ template<unsigned char C> void f(int (&a)[C]); // expected-note 2{{candidate template ignored}}
+ void g() {
+ int arr512[512];
+ f(arr512); // expected-error{{no matching function for call}}
+ f<512>(arr512); // expected-error{{no matching function for call}}
+ }
+}