]> granicus.if.org Git - clang/commitdiff
Add test coverage for array to pointer decay in non-type template parameters.
authorDavid Blaikie <dblaikie@gmail.com>
Wed, 27 Feb 2013 22:10:37 +0000 (22:10 +0000)
committerDavid Blaikie <dblaikie@gmail.com>
Wed, 27 Feb 2013 22:10:37 +0000 (22:10 +0000)
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

test/SemaTemplate/temp_arg_nontype.cpp

index 434054ecbdf28bb68f5cdcff44e56ebae5991389..210b5e463f635b99aa1a19295229212cd8f9bef4 100644 (file)
@@ -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}}
   }
 
 }