Home | History | Annotate | Download | only in tests
      1 #include <stdio.h>
      2 #include <valgrind.h>
      3 
      4 /* GCC 3.4.6 will not compile inlined member template functions.
      5    Let's assume GCC 4.x does */
      6 #ifdef __GNUC__
      7 #if __GNUC__ > 3
      8 #define INLINE    inline __attribute__((always_inline))
      9 #else
     10 #define INLINE
     11 #endif
     12 #endif
     13 
     14 class X
     15 {
     16 public:
     17 
     18    template <typename T>
     19    static INLINE T temp_member_func_b(T argb) {
     20       static T locb = 0;
     21       if (argb > 0)
     22          locb += argb;
     23       return locb;
     24    }
     25 
     26    template <typename T>
     27    static /*INLINE*/ T temp_member_func_noinline(T arga) {
     28        return temp_member_func_b(arga);
     29    }
     30 
     31 };
     32 
     33 
     34 int main() {
     35    int result;
     36    result = X::temp_member_func_noinline(result);
     37    return 0;
     38 }
     39 
     40