Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
User name:
Password:
Save Password
Forgot your password?

 All Forums
 Visual Assist
 Technical Support
 Move Implementation fooled by C++11 init syntax
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

jschroedl
Tomato Guru

USA
103 Posts

Posted - Jan 20 2014 :  08:20:38 AM  Show Profile  Reply with Quote
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 }
{
}

accord
Whole Tomato Software

United Kingdom
3287 Posts

Posted - Jan 20 2014 :  4:36:31 PM  Show Profile  Reply with Quote
I am seeing the same effect here. Thank you for the clear description.

case=79737
Go to Top of Page

sean
Whole Tomato Software

USA
2817 Posts

Posted - Nov 07 2014 :  09:52:20 AM  Show Profile  Reply with Quote
case=79737 is fixed in build 2052
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
© 2023 Whole Tomato Software, LLC Go To Top Of Page
Snitz Forums 2000