https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68926

            Bug ID: 68926
           Summary: decltype and sfinae to check for template instance
                    availability
           Product: gcc
           Version: 5.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: grygoriy.fuchedzhy at gmail dot com
  Target Milestone: ---

Hi,
here is minimal example of code which I believe valid, compiles using
clang-3.5.2, but fails to compile using gcc-4.9.3 gcc-5.2.0 gcc-5.3.0
returning:
no type named ‘type’ in ‘struct std::enable_if<false, void>’

#include <type_traits>

template<typename T>
typename std::enable_if<std::is_same<int, T>::value>::type
func();

template<typename T, typename = decltype(func<T>)>
std::true_type test(T);

std::false_type test(...);

int main()
{
   decltype(test(0))::value;   // ok
   decltype(test(0.f))::value; // error
}

Reply via email to