1 // PR c++/47488 - sorry, unimplemented: string literal in function
2 // template signature
3 // { dg-do compile }
4 // { dg-options "-Wall" }
5 
6 #if __cpluspls >= 201103L
7 
8 // C++ 11 test case from comment #0.
9 namespace comment_0 {
10 
11 template <typename T>
12 int f (const T&, const char *);
13 
14 template <typename T>
15 decltype (f (T (), "")) g (const T &);
16 
h()17 void h ()
18 {
19   g (0);
20 }
21 
22 }   // comment_0
23 
24 #endif
25 
26 // C++ 98 test case from comment #1.
27 namespace comment_1 {
28 
29 template <typename T>
30 int  f(const T&, const char *);
31 
32 template<int> struct N { };
33 
34 template <typename T>
35 N<sizeof (f (T (), ""))> g (const T&);
36 
h()37 void h ()
38 {
39   g (0);
40 }
41 
42 }   // comment_1
43 
44 // C++ 98 test case from comment #2.
45 namespace comment_2 {
46 
47 template <typename T>
48 int f (const char *);
49 
50 template<int> struct N { };
51 
52 template <typename T>
53 N<sizeof (f<T>(""))> g (const T &);
54 
h()55 void h ()
56 {
57   g (0);
58 }
59 
60 }   // comment_2
61 
62 
63 #if __cpluspls >= 201103L
64 
65 // C++ 11 test case from comment #5.
66 namespace comment_5 {
67 
f(const T * p)68 template <typename T> constexpr T f(const T* p) { return p[0]; }
69 template <int> struct N { };
g(T,N<f ((const T *)"1")>)70 template <typename T> void g (T, N<f((const T*)"1")>) { }
g(T,N<f ((const T *)"2")>)71 template <typename T> void g (T, N<f((const T*)"2")>) { }
72 
h()73 void h ()
74 {
75   g ('1', N<'1'>());
76   g ('2', N<'2'>());
77 }
78 
79 }
80 
81 #endif
82