| 1 |
/* PR c++/84294 - attributes on a function template redeclaration silently |
| 2 |
discarded |
| 3 |
{ dg-do compile } |
| 4 |
{ dg-options "-O -fdump-tree-optimized" } */ |
| 5 |
|
| 6 |
template <void test ()> |
| 7 |
void test_func () |
| 8 |
{ |
| 9 |
test (); |
| 10 |
} |
| 11 |
|
| 12 |
int x; |
| 13 |
|
| 14 |
void __attribute__ ((noinline)) func_noinline_none (); |
| 15 |
void func_noinline_none () { x = __LINE__; } |
| 16 |
|
| 17 |
template void test_func<func_noinline_none>(); |
| 18 |
// { dg-final { scan-tree-dump-times "func_noinline_none *\\(\\);" 1 "optimized" } } |
| 19 |
|
| 20 |
|
| 21 |
void func_none_noinline (); |
| 22 |
void __attribute__ ((noinline)) func_none_noinline () { x = __LINE__; } |
| 23 |
|
| 24 |
template void test_func<func_none_noinline>(); |
| 25 |
// { dg-final { scan-tree-dump-times "func_none_noinline *\\(\\);" 1 "optimized" } } |
| 26 |
|
| 27 |
|
| 28 |
template <class> |
| 29 |
void __attribute__ ((noinline)) templ_noinline_none () { x = __LINE__; } |
| 30 |
|
| 31 |
template <class> |
| 32 |
void templa_noinline_none (); |
| 33 |
|
| 34 |
template void test_func<templ_noinline_none<int> >(); |
| 35 |
// { dg-final { scan-tree-dump-times "templ_noinline_none<int> *\\(\\);" 1 "optimized" } } |
| 36 |
|
| 37 |
|
| 38 |
template <class> |
| 39 |
void templ_none_noinline (); |
| 40 |
|
| 41 |
template <class> |
| 42 |
void __attribute__ ((noinline)) templ_none_noinline () { x = __LINE__; } |
| 43 |
|
| 44 |
template void test_func<templ_none_noinline<int> >(); |
| 45 |
// { dg-final { scan-tree-dump-times "templ_none_noinline<int> *\\(\\);" 1 "optimized" } } |