| 1 |
// DESCRIPTION |
| 2 |
// |
| 3 |
// Test to check whether the C++ compiler supports numeric traits promotions. |
| 4 |
// In sync with AC_CXX_USE_NUMTRAIT (2008-04-12). |
| 5 |
// |
| 6 |
// COPYLEFT |
| 7 |
// |
| 8 |
// Copyright (c) 2008 Todd Veldhuizen |
| 9 |
// Copyright (c) 2009 Theo Papadopoulo <[email protected]> |
| 10 |
// Copyright (c) 2008 Luc Maisonobe <[email protected]> |
| 11 |
// |
| 12 |
// Copying and distribution of this file, with or without modification, are |
| 13 |
// permitted in any medium without royalty provided the copyright notice |
| 14 |
// and this notice are preserved. |
| 15 |
|
| 16 |
#ifndef HAVE_TYPENAME |
| 17 |
#define typename |
| 18 |
#endif |
| 19 |
|
| 20 |
template<class T_numtype> class SumType { public: typedef T_numtype T_sumtype; }; |
| 21 |
template<> class SumType<char> { public: typedef int T_sumtype; }; |
| 22 |
|
| 23 |
template<class T> class A {}; |
| 24 |
template<class T> A<typename SumType<T>::T_sumtype> sum(A<T>) { |
| 25 |
return A<typename SumType<T>::T_sumtype>(); |
| 26 |
} |
| 27 |
|
| 28 |
int main() { |
| 29 |
A<float> x; |
| 30 |
sum(x); |
| 31 |
return 0; |
| 32 |
} |