[Bug c++/20098] Unresolved dependent "static const" symbol in template

pinskia at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Sun Feb 20 13:35:00 GMT 2005


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-02-20 00:34 -------
(In reply to comment #3)
> Subject: Re:  Unresolved dependent "static const" symbol in template
> 
> Thanks for a REALLY quick reply!
> 
> template<typename T>struct A
> {
>  static const T all_clr = T(0);
>  static const T all_set = ~all_clr;
> };
> 
> int main()
> {
>  A<int> bf;
>  
>  return(bf.all_set);
> }
> 
> On Sunday 20 February 2005 01:12, pinskia at gcc dot gnu dot org wrote:
> > Note the testcase is invalid code, 
> >
> Could you please elaborate on what exactly is invalid?

Yes you need to have declare the storage for the static variables (even though they are constant you still 
need the storage area, for an example if you take the address of the variable where is the storage of the 
variable if you have not declared it).

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20098



More information about the Gcc-bugs mailing list