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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |rejects-valid
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2012-02-03
     Ever Confirmed|0                           |1
      Known to fail|                            |4.6.2, 4.7.0

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> 2012-02-03 
14:37:35 UTC ---
Confirmed, x_pair shouldn't be instantiated to form x_pair*

Reduced:

struct true_type { static const bool value = true; };
struct false_type { static const bool value = false; };

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

template <class T>
struct my_t_alloc_p
{
    typedef T  value_type;
    typedef value_type* pointer;       // <--- see Incomplete below
};

struct type_selector
{
#if 1
    // T::pointer should be present
    template <class T>
    static decltype( declval<typename T::pointer>(), declval<true_type>())
__test_p( int );
#else
    // If the declaration above re-write as below (worse, IMO), then it pass:
    template <class T>
    static decltype( T::pointer(), declval<true_type>() ) __test_p( int );
#endif

    template <class>
    static false_type __test_p( ... );
};

template <class Alloc>
struct x_allocator_traits
{
    typedef decltype(type_selector::__test_p<Alloc>(0)) pointer;
};

template <class A>
struct x_pair
{
    A a;
};

struct Incomplete
{
    typedef typename x_allocator_traits<my_t_alloc_p<x_pair<Incomplete> >
>::pointer pointer6;
};

Reply via email to