Dear users,
Since I'm completely new to this list, I'm not sure what type of
questions should be posted here, but hopefully someone can point me in a
better direction, if this is not the right place.
So here's the thing. Consider the following relatively simple piece of code:
class A {
int d_errno;
public:
A(int errno);
virtual ~A() {};
};
A::A(int errno)
:
d_errno(errno)
{}
struct B: public A {
public:
B()
:
A::A(10)
{}
};
When compiling such code as standard c++, there is no problem. But now I
add the option -std=c++0x (for other pieces of code where I want to
experiment a bit with the new possibilities)
If I then try to compile, I get:
bool.h: In constructor ‘B::B()’:
bool.h:24:9: error: invalid conversion from ‘int’ to ‘int* (*)()’
bool.h:24:9: error: initializing argument 1 of ‘A::A(int* (*)())’
So for some reason the compiler makes the constant '10' into some
function pointer instead of just an int. It also happens if I explicitly
put a cast on the '10'. Am I trying to do something that is not legal
anymore in c++0x or am I looking at some weird bug in the compiler?
Additional info:
this is with g++ 4.5.2, built in a non-standard location on
x86_64-unknown-linux-gnu (actually, it is CentOS) using:
Configured with: ./configure
--prefix=/data/users/jakobb/linux/64/comp_packs/gcc-4.5.2
--with-gmp=/data/users/jakobb/linux/64
--with-mpfr=/data/users/jakobb/linux/64
--with-mpc=/data/users/jakobb/linux/64
--with-ppl=/data/users/jakobb/linux/64 --enable-threads=posix
--enable-checking=release --with-system-zlib
Thread model: posix
gcc version 4.5.2 (GCC)
Yours sincerely,
Jakob van Bethlehem