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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2014-09-02
      Known to work|                            |4.7.4
            Summary|Class-scope typedef         |[4.8/4.9/5 Regression]
                   |overwrites typedef of       |Class-scope typedef
                   |previously defined class    |overwrites typedef of
                   |                            |previously defined class
     Ever confirmed|0                           |1

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Weird, somehow make_type_list_t<Ts..., X> and make_type_list_t<Ts... Y> end up
referring to the same specialization.

Reduced to remove the library header:

template<typename ...T>
struct type_list {};

template<typename ...T>
struct make_type_list
{
    using type = type_list<T...>;
};

// The bug disappears if you use make_type_list directly.
template<typename ...T>
using make_type_list_t = typename make_type_list<T...>::type;


struct ContainerEndA {};

template<typename ...Ts>
struct ContainerA
{
    using type = make_type_list_t<Ts..., ContainerEndA>;
};


struct ContainerEndB {};

template<typename ...Ts>
struct ContainerB
{
    using type = make_type_list_t<Ts..., ContainerEndB>;
};

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

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

int main()
{
    static_assert(
        is_same<ContainerB<>::type, type_list<ContainerEndB>>::value,
        "This assert doesn't fail, as expected"
    );
    static_assert(
        is_same<ContainerA<>::type, type_list<ContainerEndB>>::value,
        "This assert doesn't fail but it clearly should!"
    );
    static_assert(
        is_same<ContainerA<>::type, ContainerB<>::type>::value,
        "This assert doesn't fail but it clearly should!"
    );
}

Reply via email to