diff options
author | David Blaikie <dblaikie@gmail.com> | 2013-02-27 22:10:37 +0000 |
---|---|---|
committer | David Blaikie <dblaikie@gmail.com> | 2013-02-27 22:10:37 +0000 |
commit | 98b879af5bfb50123a668dc1de6dd86feb9991c5 (patch) | |
tree | 0be81bd2beba5d474247d42942612223ade1eade | |
parent | c661e1248079f6f87ac47a45f034067580ab2f1c (diff) |
Add test coverage for array to pointer decay in non-type template parameters.
Functionality committed in r172585 but tested the function case without the
array case.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176215 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | test/SemaTemplate/temp_arg_nontype.cpp | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/test/SemaTemplate/temp_arg_nontype.cpp b/test/SemaTemplate/temp_arg_nontype.cpp index 434054ecbd..210b5e463f 100644 --- a/test/SemaTemplate/temp_arg_nontype.cpp +++ b/test/SemaTemplate/temp_arg_nontype.cpp @@ -325,16 +325,15 @@ template <int& I> struct PR10766 { static int *ip; }; template <int& I> int* PR10766<I>::ip = &I; namespace rdar13000548 { - template<typename R, R F(int)> - struct X { - typedef R (*fptype)(int); - static fptype f() { return &F; } // expected-error{{cannot take the address of an rvalue of type 'int (*)(int)'}} - }; + template<typename R, typename U, R F> + U f() { return &F; } // expected-error{{cannot take the address of an rvalue of type 'int (*)(int)'}} expected-error{{cannot take the address of an rvalue of type 'int *'}} int g(int); + int y[3]; void test() { - X<int, g>::f(); // expected-note{{in instantiation of}} + f<int(int), int (*)(int), g>(); // expected-note{{in instantiation of}} + f<int[3], int*, y>(); // expected-note{{in instantiation of}} } } |