Mercurial > hg > CbC > CbC_gcc
view gcc/testsuite/g++.dg/cpp0x/udlit-sfinae.C @ 131:84e7813d76e9
gcc-8.2
author | mir3636 |
---|---|
date | Thu, 25 Oct 2018 07:37:49 +0900 |
parents | 04ced10e8804 |
children |
line wrap: on
line source
// { dg-do run { target c++11 } } #include <cassert> template<bool, typename _Tp = void> struct enable_if { }; template<typename _Tp> struct enable_if<true, _Tp> { typedef _Tp type; }; template <char... c> constexpr typename enable_if<sizeof...(c) == 2, int>::type operator""_t () { return 2; } template <char... c> constexpr typename enable_if<sizeof...(c) == 1, int>::type operator""_t () { return 1; } template <char... c> constexpr typename enable_if<sizeof...(c) >= 3, int>::type operator""_t () { return 100; } int operator""_t (long double) { return 200; } int main () { assert (45_t == 2); assert (4_t == 1); assert (100000_t == 100); assert (200.0_t == 200); }