public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Aldy Hernandez <aldyh@redhat.com>
To: GCC Mailing List <gcc@gcc.gnu.org>
Subject: is_a<> with references
Date: Wed, 1 Jun 2022 16:29:43 +0200	[thread overview]
Message-ID: <CAGm3qMVAwf0dN6CD7tkYjC6-6+iRUQw4WOo_KMHqzde+0opDXA@mail.gmail.com> (raw)

Hi folks.

I rolled our own is_a<> implementation for vrange, because it was
trivial.  We needed it to work on references, and GCC's is-a.h
implementation is pointer-only. However, I now realize it confuses
gengtype when adding additional types:

template<typename T>
struct vrange_traits
{
  // Default to something unusable.
  typedef void range_type;
};

template<>
struct vrange_traits<irange>
{
  typedef irange range_type;
};

template<>
struct vrange_traits<frange>
{
  typedef frange range_type;  <-- BOO! HISS!
};

build/gengtype  \
                    -S /home/aldyh/src/gcc/gcc -I gtyp-input.list -w
tmp-gtype.state
/home/aldyh/src/gcc/gcc/value-range.h:291: type `range_type' previously defined
/home/aldyh/src/gcc/gcc/value-range.h:285: previously defined here

Can some gengtype guru offer guidance?

Thanks.
Aldy


             reply	other threads:[~2022-06-01 14:29 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-01 14:29 Aldy Hernandez [this message]
2022-06-01 15:33 ` Aldy Hernandez

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=CAGm3qMVAwf0dN6CD7tkYjC6-6+iRUQw4WOo_KMHqzde+0opDXA@mail.gmail.com \
    --to=aldyh@redhat.com \
    --cc=gcc@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).