Re: C++ [RFC] taking address of a static const data member

2005-03-13 Thread Jonathan Wakely
On Fri, Mar 11, 2005 at 11:49:22AM -0800, Fariborz Jahanian wrote: > Thanks Andrew. Yes, standard actually mentions this that I missed. It's also doc'd here: http://gcc.gnu.org/onlinedocs/gcc/Static-Definitions.html#Static-Definitions jon

Re: C++ [RFC] taking address of a static const data member

2005-03-11 Thread Fariborz Jahanian
Thanks Andrew. Yes, standard actually mentions this that I missed. - fariborz On Mar 11, 2005, at 11:25 AM, Andrew Pinski wrote: On Mar 11, 2005, at 2:16 PM, Fariborz Jahanian wrote: So, is g++ correct in rejecting this seemingly good user code? Yes you need a place to store the data. So for an ex

Re: C++ [RFC] taking address of a static const data member

2005-03-11 Thread Andrew Pinski
On Mar 11, 2005, at 2:16 PM, Fariborz Jahanian wrote: So, is g++ correct in rejecting this seemingly good user code? Yes you need a place to store the data. So for an example in your original testcase, you need: const int Foo::foo; Which fixes the problem and yes 9.4.2 explains this (I cannot find

C++ [RFC] taking address of a static const data member

2005-03-11 Thread Fariborz Jahanian
Section 9.4.2 of c++ standard "Static data members" does not directly address this issue. But there is a dejagnu c++ test case which explicitly disallows (by issuing a link-time error) taking address of a static const data member. Test case is const2.C. This question has come up because, g++-4.