About Store Forum Documentation Contact



Post Reply 
Code editor bug: base/member initialization in derived class
Author Message
Tottel Offline
Member

Post: #1
Code editor bug: base/member initialization in derived class
Hi there,

The title is a bit vague, but this is the issue:

1. I have a class DerivedClass that derives from BaseClass
2. Both classes have a custom constructor
3. I have class members in DerivedClass that I want to initialize when declaring.
4. I call the constructor of BaseClass from the constructor of DerivedClass.
5. This gives me an error: Error 1 error C2612: trailing ':' illegal in base/member initializer list

This is the code in Code Editor:

Code:
private:    
   int _classMember = -1;

public:
   DerivedClass(Object* object) : BaseClass(object)
   { }

This is what it turns into in c++ code:

Code:
private:    
   int _classMember;

public:
   DerivedClass(Object object) : BaseClass(object) : _classMember(-1)
   { }

That should be a ",", of course. I know I can just initialize the variables myself in the constructor initialization list, but I find the Esenthel way of working more convenient. pfft It would be nice if it worked.

(If I add just 1 class member to the constructor init list, everything works fine, and I can initialize all class members when declaring)

Thanks!
02-27-2015 03:09 PM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #2
RE: Code editor bug: base/member initialization in derived class
Thank you for reporting the issue!
I'll try to fix it now.
02-27-2015 09:55 PM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #3
RE: Code editor bug: base/member initialization in derived class
Thanks!

The fix is now available in the source (main "master" branch is up to date).
02-27-2015 10:25 PM
Find all posts by this user Quote this message in a reply
Post Reply