| 1 |
// Testcase for mangling of parameters used other than in a trailing return type |
| 2 |
// { dg-do compile { target c++11 } } |
| 3 |
// { dg-options "-fabi-version=5 -fabi-compat-version=5 -Wabi=4" } |
| 4 |
|
| 5 |
template<class T> void f(T p, decltype(p)) { } // L = 1 { dg-warning "mangle" } |
| 6 |
template<class T> void g(T p, decltype(p) (*)()) { } // L = 1 { dg-warning "mangle" } |
| 7 |
// G++ incorrectly rejects these currently. |
| 8 |
// template<class T> void h(T p, auto (*)()->decltype(p)); // L = 1 |
| 9 |
// template<class T> void i(T p, auto (*)(T q)->decltype(q)); // L = 0 |
| 10 |
// template<class T> void j(T p, auto (*)(decltype(p))->T); // L = 2 |
| 11 |
template<class T> void k(T p, int (*(*)(T* p))[sizeof(p)]) {} // L = 1 { dg-warning "mangle" } |
| 12 |
|
| 13 |
int garg(); |
| 14 |
int (*karg (int*))[sizeof(int)]; |
| 15 |
int main() |
| 16 |
{ |
| 17 |
// { dg-final { scan-assembler "\n_?_Z1fIiEvT_DtfL0p_E\[: \t\n\]" } } |
| 18 |
f (1,0); |
| 19 |
// { dg-final { scan-assembler "\n_?_Z1gIiEvT_PFDtfL0p_EvE\[: \t\n\]" } } |
| 20 |
g (1,garg); |
| 21 |
// h (1,0); |
| 22 |
// i (1,0); |
| 23 |
// j (1,0); |
| 24 |
// { dg-final { scan-assembler "\n_?_Z1kIiEvT_PFPAszfL0p__iPS0_E\[: \t\n\]" } } |
| 25 |
k (1,karg); |
| 26 |
} |