[galib] [PATCH] Unqualified lookup compilation error

TR tiago.shibata at thunderatz.org
Sun Sep 6 10:38:45 EDT 2015


Before GCC 4.7, unqualified lookup of parent template functions was done, which was non-standard. 4.7 fixes it:

https://gcc.gnu.org/gcc-4.7/porting_to.html
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=24163

Right now, GAlib's examples and code that includes GA2DArrayGenome.h won't compile without -fpermissive. The issue is mentioned at:

http://mailman.mit.edu/pipermail/galib/2014-August/001827.html
http://mailman.mit.edu/pipermail/galib/2013-September/001817.html

The patch is pretty simple:

diff -rupN galib247/ga/GA2DArrayGenome.C galib247_patched/ga/GA2DArrayGenome.C
--- galib247/ga/GA2DArrayGenome.C	2015-09-06 13:23:47.179895399 -0300
+++ galib247_patched/ga/GA2DArrayGenome.C	2015-09-06 11:16:10.719950539 -0300
@@ -269,10 +269,10 @@ GA2DArrayGenome<T>(width,height,f,u){
   aset = new GAAlleleSet<T>[1];
   aset[0] = s;
 
-  initializer(GA2DArrayAlleleGenome<T>::DEFAULT_2DARRAY_ALLELE_INITIALIZER);
-  mutator(GA2DArrayAlleleGenome<T>::DEFAULT_2DARRAY_ALLELE_MUTATOR);
-  comparator(GA2DArrayAlleleGenome<T>::DEFAULT_2DARRAY_ALLELE_COMPARATOR);
-  crossover(GA2DArrayAlleleGenome<T>::DEFAULT_2DARRAY_ALLELE_CROSSOVER);
+  this->initializer(GA2DArrayAlleleGenome<T>::DEFAULT_2DARRAY_ALLELE_INITIALIZER);
+  this->mutator(GA2DArrayAlleleGenome<T>::DEFAULT_2DARRAY_ALLELE_MUTATOR);
+  this->comparator(GA2DArrayAlleleGenome<T>::DEFAULT_2DARRAY_ALLELE_COMPARATOR);
+  this->crossover(GA2DArrayAlleleGenome<T>::DEFAULT_2DARRAY_ALLELE_CROSSOVER);
 }
 
 template <class T> 
@@ -286,10 +286,10 @@ GA2DArrayGenome<T>(width,height, f, u) {
   for(int i=0; i<naset; i++)
     aset[i] = sa.set(i);
 
-  initializer(GA2DArrayAlleleGenome<T>::DEFAULT_2DARRAY_ALLELE_INITIALIZER);
-  mutator(GA2DArrayAlleleGenome<T>::DEFAULT_2DARRAY_ALLELE_MUTATOR);
-  comparator(GA2DArrayAlleleGenome<T>::DEFAULT_2DARRAY_ALLELE_COMPARATOR);
-  crossover(GA2DArrayAlleleGenome<T>::DEFAULT_2DARRAY_ALLELE_CROSSOVER);
+  this->initializer(GA2DArrayAlleleGenome<T>::DEFAULT_2DARRAY_ALLELE_INITIALIZER);
+  this->mutator(GA2DArrayAlleleGenome<T>::DEFAULT_2DARRAY_ALLELE_MUTATOR);
+  this->comparator(GA2DArrayAlleleGenome<T>::DEFAULT_2DARRAY_ALLELE_COMPARATOR);
+  this->crossover(GA2DArrayAlleleGenome<T>::DEFAULT_2DARRAY_ALLELE_CROSSOVER);
 }
 
Will it get fixed? Is anyone maintaining the code right now?

Thanks,

-- 
Tiago Koji Castro Shibata
Equipe ThundeRatz de Robótica
Engenharia de Computação - Escola Politécnica da USP



More information about the galib mailing list