This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 250831

Summary: Wrong formatting of brace-initialized constructor initializerlists
Product: cnd Reporter: etrof
Component: EditorAssignee: issues@cnd <issues>
Status: RESOLVED DUPLICATE    
Severity: normal    
Priority: P4    
Version: 8.0.2   
Hardware: PC   
OS: Linux   
Issue Type: DEFECT Exception Reporter:

Description etrof 2015-03-02 17:37:25 UTC
Brace-initialized initializerlists – as supported since C++11 – are malformed. The expected behavior is as for old ( ) initialization.

Example:

class Example
{
public:
    Example(int a) : m_value{a} // Initialization using { }
    {
        /* Ctor body */
    }

private:
    int m_value;
};

Using auto format breaks the formatting:

    Example(int a) : m_value
    {
        a 
    }
    {
        /* Ctor body */
    }

The m_value{a} is separated into new lines.

Using normal ( ) for initializer lists – m_value(a) – works fine.
Comment 1 etrof 2015-03-02 17:45:28 UTC
Existing issue found (to late ...).

*** This bug has been marked as a duplicate of bug 246062 ***