public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "redi at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/63139] [4.8/4.9/5 Regression] Class-scope typedef overwrites typedef of previously defined class
Date: Tue, 02 Sep 2014 15:18:00 -0000	[thread overview]
Message-ID: <bug-63139-4-gHLxHZDxqd@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-63139-4@http.gcc.gnu.org/bugzilla/>

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	other threads:[~2014-09-02 15:18 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-02 14:57 [Bug c++/63139] New: " david.d.kretzmer at gmail dot com
2014-09-02 15:18 ` redi at gcc dot gnu.org [this message]
2014-09-11 13:51 ` [Bug c++/63139] [4.8/4.9/5 Regression] " jason at gcc dot gnu.org
2014-09-11 13:51 ` jason at gcc dot gnu.org
2014-09-11 17:51 ` [Bug c++/63139] [4.8 " jason at gcc dot gnu.org
2014-10-30 10:43 ` jakub at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-63139-4-gHLxHZDxqd@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).