#544693 libga-dev: inclusion of GA headers interferes with unrelated code

Package:
libga-dev
Source:
galib
Description:
C++ Library of Genetic Algorithm Components
Submitter:
Jakub Wilk
Date:
2011-11-19 22:45:08 UTC
Severity:
normal
#544693#5
Date:
2009-09-02 12:16:58 UTC
From:
To:
$ cat test.cc
#include <stdio.h>

#ifdef USE_GA
#include <ga/ga.h>
#endif

class A
{
public:
    bool operator==(const A &other)
    {
      return 0;
    }
};

class B : public A
{ };

int main()
{
    B x, y;
    return x == y;
}

$ g++ test.cc && echo $?
0

$ g++ -DUSE_GA test.cc
/tmp/cchkaUHs.o: In function `main':
test.cc:(.text+0x7b): undefined reference to `int operator==<B>(B const&, B const&)'
collect2: ld returned 1 exit status


To work around this bug/misfeature I needed to forcibly undefine
GALIB_USE_COMP_OPERATOR_TEMPLATES.