Bug 305742 - Creating a constructor implementation should automatically add initializer list for const members
Summary: Creating a constructor implementation should automatically add initializer li...
Status: CONFIRMED
Alias: None
Product: kdevelop
Classification: Applications
Component: Language Support: CPP (old) (other bugs)
Version First Reported In: 4.90.91
Platform: openSUSE Linux
: NOR wishlist
Target Milestone: ---
Assignee: kdevelop-bugs-null
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-08-24 19:54 UTC by Rolf Eike Beer
Modified: 2016-11-17 00:32 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Rolf Eike Beer 2012-08-24 19:54:18 UTC
Guess I have a class that looks like this:

class Foo : public QObject {
...
Foo(QObject *parent);

FooPrivate * const d_ptr;
const QString m_something;
};

When I now create an implementation for the constructor using the code completion I will get something like this:

Foo::Foo(QObject *parent) : QObject(parent)
{
}

The initializer list should also contain d_ptr and m_something, as they can only be ever written to in this initilizer list.

You will score extra karma points if the completion for pointers, at least for a <classname>Private pointer will not just be d_ptr(), but d_ptr(new type_of_pointer()).

You will score incredible karma if you also fill in some useful values for all this initializers, i.e. matching constructor arguments. And if a <classname>Private object has a <classname> argument then just add a "this" at that position.

Reproducible: Always
Comment 1 Aleix Pol 2013-03-31 01:39:50 UTC
It's C++ things, so put it under C++