Re: bug - SuSE10 + gcc 4.02

"Robert P. Goddard" <[email protected]> Fri, 14 Oct 2005 12:44:16 -0700
Newsgroups gmane.comp.lib.mtl.devel
Organization APL-UW
Message-ID <[email protected]>
Márcio,

This is correct behavior, seen more often now on stricter, newer 
compilers that parse templates when they are defined instead of waiting 
until they are instantiated. Check out Item 43 of Scott Meyers's new 
book, Effective C++, Third Edition. In derived class templates, where 
the base class is also a template, the derived class can't assume 
anything about the base class, including which member functions it 
declares. After all, a specialization might declare a completely 
different set. Therefore, Meyers ends the Item with:

In derived class templates, refer to names in base class templates via a 
"this->" prefix, via using declarations, or via an explirit base class 
qualification.

Bob Goddard

Márcio Ricardo Pivello wrote:

> Hi, I'm working with intel icc compiler, 9.0 and SuSE 10 with gcc 4.02 
> on a Pentiun IV 3.0 GHz. My mtl version is 2.1.2-22 and I've already 
> run the patch gcc 4.02. These errors come out even with the simple 
> code bellow:
>
> #include <itl/itl.h>
> #include <itl/interface/mtl.h>
> #include <mtl/mtl.h>
> #include <mtl/utils.h>
> #include <mtl/matrix.h>
> #include <mtl/linalg_vec.h>
> #include <vector>
>
> int main(void)
> {
>     mtl::dense1D<double> vmtlV(10,4.),vmtlV2(10,1.);
>     std::vector<double> vV(10,2.), vV2(10,3.);
>     return 0;
> }
>
> compiling with icc 9.0:
>
> icpc -I/usr/local/include/ itl_test.cpp
> /usr/include/c++/4.0.2/cmath(354): error: identifier "__builtin_powi" 
> is undefined
>     { return __builtin_powi(__x, __i); }
>              ^
>
> /usr/include/c++/4.0.2/cmath(358): error: identifier "__builtin_powif" 
> is undefined
>     { return __builtin_powif(__x, __n); }
>              ^
>
> /usr/include/c++/4.0.2/cmath(362): error: identifier "__builtin_powil" 
> is undefined
>     { return __builtin_powil(__x, __n); }
>              ^
> (.....)
>
> there are some 20 messages like these, all of them related to cmath.
>
> When I compile the very same code with gcc 4.02, here's the result:
>
> g++ -I/usr/local/include/ itl_test.cpp
> /usr/local/include/itl/itl.h: In member function 'bool 
> itl::noisy_iteration<Real>::finished(const Vector&)':
> /usr/local/include/itl/itl.h:229: error: 'i' was not declared in this 
> scope
> /usr/local/include/itl/itl.h:229: error: 'max_iter' was not declared 
> in this scope
> /usr/local/include/itl/itl.h:233: error: 'error' was not declared in 
> this scope
> /usr/local/include/itl/itl.h: In member function 'bool 
> itl::noisy_iteration<Real>::finished(const Real&)':
> /usr/local/include/itl/itl.h:249: error: 'i' was not declared in this 
> scope
> /usr/local/include/itl/itl.h:249: error: 'max_iter' was not declared 
> in this scope
> /usr/local/include/itl/itl.h:253: error: 'error' was not declared in 
> this scope
> /usr/local/include/itl/itl.h: In member function 'bool 
> itl::noisy_iteration<Real>::finished(const std::complex<_Up>&)':
> /usr/local/include/itl/itl.h:268: error: 'i' was not declared in this 
> scope
> /usr/local/include/itl/itl.h:268: error: 'max_iter' was not declared 
> in this scope
> /usr/local/include/itl/itl.h:271: error: 'error' was not declared in 
> this scope
> /usr/local/include/itl/itl.h: In member function 'int 
> itl::noisy_iteration<Real>::error_code()':
> /usr/local/include/itl/itl.h:288: error: 'error' was not declared in 
> this scope
>
> When I explicitly write
>
> using basic_iteration<real>::i;
> using basic_iteration<real>::max_iter;
>
> and so on in noisy_iteration<> it's okay, but it seems the compiler 
> does not aknowlege the inheritance  noisy_iteration : public 
> basic_iteration<real>
>
> The problem is that, in my real code, where I use solvers, 
> preconditioners, sparse matrices, there are lots of errors. I've 
> atached a file containing the output of this compilation, because it 
> is too long to put it here. I'm considering downgrade to gcc 3.3.5 to 
> keep working. Can anyone help me? BTW, here's the output of gcc -v:
>
> gcc -v
> Using built-in specs.
> Target: i586-suse-linux
> Configured with: ../configure --enable-threads=posix --prefix=/usr 
> --with-local-prefix=/usr/local --infodir=/usr/share/info 
> --mandir=/usr/share/man --libdir=/usr/lib --libexecdir=/usr/lib 
> --enable-languages=c,c++,objc,f95,java,ada --disable-checking 
> --with-gxx-include-dir=/usr/include/c++/4.0.2 --enable-java-awt=gtk 
> --disable-libjava-multilib --with-slibdir=/lib --with-system-zlib 
> --enable-shared --enable-__cxa_atexit --without-system-libunwind 
> --host=i586-suse-linux
> Thread model: posix
> gcc version 4.0.2 20050901 (prerelease) (SUSE Linux)
>
>
>
>
>
>------------------------------------------------------------------------
>
>_______________________________________________
>This list is archived at http://www.osl.iu.edu/MailArchives/mtl-devel/
>

_______________________________________________
This list is archived at http://www.osl.iu.edu/MailArchives/mtl-devel/