[Gecode] gcc 3.4 build problems
Christian Schulte
schulte at imit.kth.se
Wed Feb 23 10:04:04 CET 2005
Looks like Patrick is absolutely right :-( So eventually we need to
rewrite...
This stinks (but hey, C++ always stinks)
Christian
--
Christian Schulte, http://www.imit.kth.se/~schulte/
-----Original Message-----
From: gecode-bounces at ps.uni-sb.de [mailto:gecode-bounces at ps.uni-sb.de] On
Behalf Of pape5004
Sent: Tuesday, February 22, 2005 10:27 PM
To: 'Technical discussions about Gecode'
Subject: AW: [Gecode] gcc 3.4 build problems
Hi all!
>>>>I'm not sure if this is a bug or a feature, to me it definitely
seems like a bug.
Don't know whether anyone has already found a solution, but my good old
friend "google" said that it's a feature of gcc 3.4. See:
http://gcc.gnu.org/gcc-3.4/changes.html
If I understood the problem right here's what they say:
In a template definition, unqualified names will no longer find members of a
dependent base (as specified by [temp.dep]/3 in the C++ standard). For
example,
template <typename T> struct B {
int m;
int n;
int f ();
int g ();
};
int n;
int g ();
template <typename T> struct C : B<T> {
void h ()
{
m = 0; // error
f (); // error
n = 0; // ::n is modified
g (); // ::g is called
}
};
You must make the names dependent, e.g. by prefixing them with this->. Here
is the corrected definition of C<T>::h,
template <typename T> void C<T>::h ()
{
this->m = 0;
this->f ();
this->n = 0
this->g ();
}
As an alternative solution, you may use using declarations instead of
this->:
template <typename T> struct C : B<T> {
using B<T>::m;
using B<T>::f;
using B<T>::n;
using B<T>::g;
void h ()
{
m = 0;
f ();
n = 0;
g ();
}
};
Hope this helps....
Since I haven't gcc 3.4 installed on my machine yet I can't tell whether
this is ok, but to me it seems that the compiler just insists on a more
detailed qualification, i.e. 3 or 4 signs more to write :-D
Greetz
Patrick Pekczynski
_______________________________________________
Gecode mailing list
Gecode at ps.uni-sb.de http://www.ps.uni-sb.de/mailman/listinfo/gecode
More information about the gecode-users
mailing list