Possible bug in libstdc++ v3
Vitaly A. Repin
vitaly@radio.hop.stu.neva.ru
Wed Aug 1 11:58:00 GMT 2001
Hello, All!
The following example is very simple. There are 2 files -- header and
source.
Header file (tst.h):
#ifndef TST_H
#define TST_H
#include <string>
#include <stdexcept>
using std::string;
class bad_cfg : public std::runtime_error {
public:
bad_cfg(const string& reason, const int err_num=0) throw();
private:
const int errno;
};
#endif //TST_H
Source file (tst.cc):
#include "tst.h"
#include <iostream>
bad_cfg::bad_cfg(const string& reason, const int err_num=0) throw()
: std::runtime_error(reason), errno(err_num) {};
Compilation command:
g++ -O2 -c tst.cc -o tst.o
(Last gcc version (3.0) and libstdc++ from its distribution)
Error:
tst.cc: In constructor `bad_cfg::bad_cfg(const std::string&, int)':
tst.cc:5: anachronistic old style base class initializer
tst.cc:5: base class `std::runtime_error' already initialized
tst.cc:5: parse error before `err_num'
! But the following compilation command is successfull:
g++ -O2 -I/usr/local/include/stlport/ -c tst.cc -o tst.o
(Last gcc version (3.0) and stdlib from STLport-4.5b8 www.stlport.org)
! And if I remove "#include <iostream>" from source file then all ok in
both cases.
It seems to me, it can be the bug in libstdc++ impementation
distributed with last g++ release.
Am I right?
Pls, send your replies not only in the mailing list but to
my e-mail too. Unfortunately, I haven't subscribed to this mailing list.
Thank you.
Good-bye!
--
WBR & WBW, Vitaly.
More information about the Libstdc++
mailing list