This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [c++] fold offsetof by hand



On Aug 27, 2004, at 3:46 PM, Giovanni Bajo wrote:


Richard Henderson wrote:

Yaye.  This was easier than I thought.  All it takes for C++ is to
delay resolution in the template case.

Does this compile:


---------------------------------
#include <stddef.h>

template <int N> struct Bar;
template <> struct Bar<3> {};

template <class T>
struct Foo {
   Bar<offsetof(T, a) + 3> k;
};

struct A { int a; };

template struct Foo<A>;

---------------------------------

I quickly grepped g++.dg and I could not find a similar test. Maybe you can
add it, if/when it works.

No it does not work but it did so it is a regression, Giovanni could file a
bug?


Thanks,
Andrew Pinski


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]