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]

Bug w/ static member in template class


On my machine, I ran into the following bug:

----------------------------------------------------------------------

[gloth@unknown]$ cat common.h
struct Foo {
    Foo (int);
};

template<class T>
struct Bar { };

template<class T>
struct Bat : Bar<T> {
    virtual Foo* bug();
    static Foo bug_; 
};

template<class T> Foo Bat<T>::bug_ (1);

template<class T> Foo *Bat<T>::bug() {
    return &Bat<T>::bug_;
}

[gloth@unknown]$ cat foo.cpp
#include "common.h"

Bat<int> foo;

[gloth@unknown]$ cat bar.cpp
#include "common.h"

Bat<int> bar;

[gloth@unknown]$ g++ -shared -o libbug.so foo.cpp bar.cpp
/tmp/cca036922.o(.bss+0x8): multiple definition of `Bat<int>::bug_'
/tmp/cca036921.o(.bss+0x8): first defined here
collect2: ld returned 1 exit status

----------------------------------------------------------------------

My configuration:

- config.guess: i586-pc-linux-gnu
- Pentium 166MMX, 64MB RAM
- Linux 2.0.31, no experimental drivers
- glibc-2.0.5c with all 3 add-ons
- egcs snapshot from 22.11.1997, standard configuration
- binutils 2.8.1.0.15, standard configuration

The same problem happened with the snapshot from 05.11.1997 and a
previous kernel-release.

If anyone wants additional information, drop me a mail ...

    Tobias

-- 
Tobias Gloth    |  WWW:     http://wwwmath.uni-muenster.de/~gloth
Kuhstr. 13      |  work:    gloth@math.uni-muenster.de
48143 Muenster  |  private: gloth@unknown.westfalen.de


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