testsuite/small/template-1.cpp
raw| 1 | /* { dg-options "-DCE_EXTRACT_FUNCTIONS=f -DCE_NO_EXTERNALIZATION" }*/ |
| 2 | |
| 3 | template<bool b> int function(void) |
| 4 | { |
| 5 | if (b == true) { |
| 6 | return 1; |
| 7 | } else { |
| 8 | return 0; |
| 9 | } |
| 10 | } |
| 11 | |
| 12 | int (*fptr)(void) = function<true>; |
| 13 | |
| 14 | int f(void) |
| 15 | { |
| 16 | return fptr(); |
| 17 | } |
| 18 | |
| 19 | /* { dg-final { scan-tree-dump "return fptr\(\);" } } */ |
| 20 | /* { dg-final { scan-tree-dump "template<bool b>" } } */ |
| 21 | /* { dg-final { scan-tree-dump "function<true>" } } */ |