public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* is_a<> with references
@ 2022-06-01 14:29 Aldy Hernandez
  2022-06-01 15:33 ` Aldy Hernandez
  0 siblings, 1 reply; 2+ messages in thread
From: Aldy Hernandez @ 2022-06-01 14:29 UTC (permalink / raw)
  To: GCC Mailing List

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: is_a<> with references
  2022-06-01 14:29 is_a<> with references Aldy Hernandez
@ 2022-06-01 15:33 ` Aldy Hernandez
  0 siblings, 0 replies; 2+ messages in thread
From: Aldy Hernandez @ 2022-06-01 15:33 UTC (permalink / raw)
  To: GCC Mailing List

Issue resolved.  Typedef no longer needed.

Sorry for the noise.
Aldy

On Wed, Jun 1, 2022 at 4:29 PM Aldy Hernandez <aldyh@redhat.com> wrote:
>
> 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


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-06-01 15:33 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-01 14:29 is_a<> with references Aldy Hernandez
2022-06-01 15:33 ` Aldy Hernandez

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).