[gnu.g++.bug] [rjc@CS.UCLA.EDU: static const change

tiemann@ARKESDEN.ENG.SUN.COM (Michael Tiemann) (10/09/89)

   Michael,

   I have brought up the new beta release of g++ (Oct 2 version).

   I am having trouble with some of my (and other peoples) code that uses
   `static const foo = 5' constructs in .h files.  In previous versions,
   this worked fine.  Now, I get `Undefined symbol _foo ...' at ld-time.

   Is this a bug in the latest version of g++, or a correct implementation?

   Thanks,

   rob collins
   rjc@cs.ucla.edu

It was a screw-up.  Here is a fix:

arkesden% diff -c2 cplus-typeck.c~ cplus-typeck.c
*** cplus-typeck.c~	Sun Oct  1 23:33:05 1989
--- cplus-typeck.c	Mon Oct  9 02:20:12 1989
***************
*** 5132,5136 ****
  
    if (type == TREE_TYPE (rhs) && TREE_CODE (type) != UNKNOWN_TYPE)
!     return rhs;
  
    return convert_for_assignment (type, rhs, errtype);
--- 5132,5140 ----
  
    if (type == TREE_TYPE (rhs) && TREE_CODE (type) != UNKNOWN_TYPE)
!     {
!       if (TREE_READONLY (rhs) && TREE_CODE (rhs) == VAR_DECL)
! 	rhs = decl_constant_value (rhs);
!       return rhs;
!     }
  
    return convert_for_assignment (type, rhs, errtype);
arkesden% 

Michael