gcc/testsuite/g++.dg/ext/always_inline-1.C
raw| 1 | // { dg-options "-O0" } |
| 2 | // { dg-do compile } |
| 3 | // PR C++/34715 |
| 4 | |
| 5 | |
| 6 | namespace X |
| 7 | { |
| 8 | template <class T> |
| 9 | const T& min(const T& a, const T& b); |
| 10 | |
| 11 | template <class T> |
| 12 | inline __attribute__ ((always_inline)) const T& min(const T& a, const T& b) |
| 13 | { |
| 14 | return a < b ? a : b; |
| 15 | } |
| 16 | } |
| 17 | template <class T> |
| 18 | inline __attribute__ ((always_inline)) T y(const T& a, const T& b) |
| 19 | { |
| 20 | return X::min(a, b); |
| 21 | } |
| 22 | int main() |
| 23 | { |
| 24 | int a = 0, b = 0; |
| 25 | return y(a, b); |
| 26 | } |