http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48647

           Summary: [C++0x] SFINAE does not handle incompatible pointer
                    types well in conditional operator
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassig...@gcc.gnu.org
        ReportedBy: gintensub...@gmail.com


template< class T >
T&& declval();

template< class T, class U >
decltype( true ? declval<T>() : declval<U>() ) test( int );

template< class T, class U >
void test( ... );


template< class T, class U >
struct is_same {
  static const bool value = false;
};

template< class T >
struct is_same<T, T> {
  static const bool value = true;
};

int main()
{
  typedef decltype( test<int*, double*>(0) ) void_expected;
  static_assert( is_same<void_expected, void>::value,  "This should be true,
and" );
  static_assert( is_same<void_expected, void*>::value, "this should be false."
);
}

-------------------


In this code, type of expression 'test<int*, double*>(0)' should be void,
but gcc (-std=c++0x) says it's void*, on all of following versions:

4.5.1
4.6.0
4.6.1-20110415
4.7.0-20110416

Reply via email to