r176215 - Add test coverage for array to pointer decay in non-type template parameters.

David Blaikie dblaikie at gmail.com
Wed Feb 27 14:10:38 PST 2013


Author: dblaikie
Date: Wed Feb 27 16:10:37 2013
New Revision: 176215

URL: http://llvm.org/viewvc/llvm-project?rev=176215&view=rev
Log:
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.

Modified:
    cfe/trunk/test/SemaTemplate/temp_arg_nontype.cpp

Modified: cfe/trunk/test/SemaTemplate/temp_arg_nontype.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaTemplate/temp_arg_nontype.cpp?rev=176215&r1=176214&r2=176215&view=diff
==============================================================================
--- cfe/trunk/test/SemaTemplate/temp_arg_nontype.cpp (original)
+++ cfe/trunk/test/SemaTemplate/temp_arg_nontype.cpp Wed Feb 27 16:10:37 2013
@@ -325,16 +325,15 @@ template <int& I> struct PR10766 { stati
 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}}
   }
 
 }





More information about the cfe-commits mailing list