2 msglibstdc++ regression from 4.1.1 to current live...
2 msgIs there a way of getting old messages deleted ...

Problem when using template as the base class?
\ Peng Yu (22 Sep 2006)
. \ Peng Yu (22 Sep 2006)
. . \ Daniel Llorens del Río (23 Sep 2006)

4 msgConfirmation request (SpugSpam=conf:PSWbJYcbUDk...
2 msgcc1plus
1 msgfloating point exception flags and compiler opt...
2 msgexception handling support
1 msgPiping with gfortran-4.1.1
1 msgproblem when linking against static lib of stlport
1 msgcan't compile objective-c
2 msgdebugger
1 msgfailed to compile gcc 4.1.1 on Solaris 10 with ...
2 msgREG : Program received signal SIGSEGV, Segmenta...
3 msgcross GCC building error
3 msgArguments to genrecog.c
2 msgRE: Compiling mult-threaded C code on AIX
2 msgTemp Registers
2 msgGCC compilation error
2 msggcc 4.* template question
1 msg.
Subject:Problem when using template as the base class?
Group:Gcc-help
From:Peng Yu
Date:22 Sep 2006


Hi,

I have the following program. It also includes the non-template
equivalent class, which works fine. If you uncomment the comments, you
will see the compiler errors. The errors are also shown below. Do you
know what is wrong? Is it a bug of the compiler?

BTW, I use g++-3.4.

Thanks,
Peng


//////////////////////////////////////////////////
#include <iostream>
#include <boost/program_options.hpp>

class base_arguments {
public:
base_arguments() {}
protected:
boost::program_options::variables_map _vm;

};

/*template <typename T>
class plot_arguments : public T {
public:
plot_arguments() {}
int boundary_pad() const {
return T::_vm["boundary_pad"].as<int>();
}

};*/

class plot_arguments1 : public base_arguments {
public:
plot_arguments1(){}
int boundary_pad() const {
return base_arguments::_vm["boundary_pad"].as<int>();
}

};

int main(int argc, char *argv[])
{
//plot_arguments<base_arguments> arg();
plot_arguments1 arg1();
}

////////////////////////////////////////////////

The error that I get is:

main_1mod_bim_plot.cc: In member function `int
plot_arguments<T>::boundary_pad() const':
main_1mod_bim_plot.cc:16: error: expected primary-expression before
"int"
main_1mod_bim_plot.cc:16: error: expected `;' before "int"
main_1mod_bim_plot.cc:16: error: expected primary-expression before
"int"
main_1mod_bim_plot.cc:16: error: expected `;' before "int"
main_1mod_bim_plot.cc: At global scope:
main_1mod_bim_plot.cc:29: warning: unused parameter 'argc'
main_1mod_bim_plot.cc:29: warning: unused parameter 'argv'
make: *** [main_1mod_bim_plot-g.o] Error 1


© 2004-2008 readlist.com