Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
 All Forums
 Visual Assist
 Technical Support
 Move Implementation fooled by C++11 init syntax

You must be registered to post a reply.
Click here to register.

Screensize:
UserName:
Password:
Format: BoldItalicizeUnderlineStrikethrough Align leftCenterAlign right Insert horizontal ruleUpload and insert imageInsert hyperlinkInsert email addressInsert codeInsert quoted textInsert listInsert Emoji
   
Message:

Forum code is on.
Html is off.

 
Check to subscribe to this topic.
   

T O P I C    R E V I E W
jschroedl Posted - Jan 20 2014 : 08:20:38 AM
Using VS 2013 with VA 10.8.2023.0

Start with test.h. Note the braces initializer syntax on m_member.

class Test {
	int m_member;
public:
	Test(int val) : m_member{ val } {}
};


Now attempt to Move Implementation to Source file of the Test ctor.

We're left with bad code in test.h and test.cpp.

test.h after has extra { }:

class Test {
	int m_member;
public:
	Test(int val); {}
};


test.cpp after is missing the ctor body and the initializer has been used as the ctor body.

Test::Test(int val) : m_member
{
	val
}


Should be:

Test::Test(int val) : m_member{ val }
{
}

2   L A T E S T    R E P L I E S    (Newest First)
sean Posted - Nov 07 2014 : 09:52:20 AM
case=79737 is fixed in build 2052
accord Posted - Jan 20 2014 : 4:36:31 PM
I am seeing the same effect here. Thank you for the clear description.

case=79737

© 2023 Whole Tomato Software, LLC Go To Top Of Page
Snitz Forums 2000