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

Daniel Krügler <daniel.kruegler at googlemail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |daniel.kruegler@googlemail.
                   |                            |com

--- Comment #1 from Daniel Krügler <daniel.kruegler at googlemail dot com> ---
The same problem occurs for gcc 4.9.0 20130616 (experimental) as well.

A version without any dependencies to the library headers:

//--------------------------------
template<bool, class T = void>
struct enable_if {};

template<class T>
struct enable_if<true, T>
{
  using type = T;
};

template<class T>
struct is_true
{
  static constexpr bool value = true;
};

extern void* enabler;

template <typename T, typename enable_if<is_true<T>::value>::type*& = enabler>
class A
{
public:
    A()
    {}
    template <typename U>
    A& operator=( A<U>&& rhs )
    {
        return *this;
    }
};

int main()
{
    A<int> a_i;
    A<double> a_d;

    a_i = a_d;
}
//---------------------------------------------------------

Gives as well:

"
main.cpp|36|required from here|
main.cpp|36|internal compiler error: in unify, at cp/pt.c:17325|
"

It is interesting to note that a variation of this sfinae construction doesn't
produce the ICE:

template <typename T, typename enable_if<is_true<T>::value, bool>::type =
false>
class A
{
public:
    A()
    {}
    template <typename U>
    A& operator=( A<U>&& rhs )
    {
        return *this;
    }
};

int main()
{
    A<int> a_i;
    A<double> a_d;

    a_i = a_d;
}

Reply via email to