Re: Strange behaviour in derived class when using -std=c++0x

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, 20 Feb 2011, Jakob van Bethlehem wrote:

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)

Why are you writing A::A instead of just A?

{}
};

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* (*)())’

The message could certainly be improved.

--
Marc Glisse


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux