This is the mail archive of the gcc@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: pointer member constant expression


On Feb 27, 2006, at 11:35 AM, Joe Buck wrote:
On Mon, Feb 27, 2006 at 12:00:42PM -0000, Dave Korn wrote:
It has been illegal to initialise a static class member inside the class
definition since sometime back in the early 90s. You must provide a static
instantiation elsewhere and initialise that.

g++ used to allow in-class-definition initializations that the standard
does not; some of these have either bit-rotted or been removed over time.

I would be curious to know why the standards committee decided not to allow pointers to members as initializers inside classes. It seems like it would always be a constant that could be computed at compile time -- but maybe I'm missing something. I can, perhaps, understand why it is not allowed within the class as the class is being defined (or declared). But, relative to all the other hard things that a C++ compiler has to figure out at compile time, that seems relatively simple as well.



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