This is the mail archive of the gcc-bugs@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]

[Bug c++/44579] New: Extern doesn work for const arrays


Given file foo.cc:
 const
 int     arr[] = {0};
compiled to foo.o, and file bar.cc:
  extern
  const
  int     arr[];

  int main() {
      return arr[0];
      }
compiled and linked with foo.o, you get:
  s3:~/ootbc/personal/ivan$ g++ bar.cc foo.o
  /tmp/ccsMPoJa.o: In function `main':
  bar.cc:(.text+0x6): undefined reference to `arr'
  collect2: ld returned 1 exit status


It works if the array isn't const.


-- 
           Summary: Extern doesn work for const arrays
           Product: gcc
           Version: 4.4.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: igodard at pacbell dot net


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


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