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
 auto types are not parsed by VA
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

narjazz96
New Member

Romania
5 Posts

Posted - Dec 06 2022 :  08:00:25 AM  Show Profile  Reply with Quote
Hi,

My issue: when declaring variables with auto type, VA does not deduce the type.

Environment:
Visual Studio 2022 17.4.2
Visual Assist X 10.9.2471.0 built 2022.11.25
Totally disabled IntelliSense

1. The tooltip quick info does not show the actual type.
https://prnt.sc/FG9VD7ZajNp7

2. The "Enchanced Listbox" (suggestion list) does not show the methods and members of the deduced type


3. For contrast here is the result when not using auto


Settings:


Thank you,
Narcis B.

feline
Whole Tomato Software

United Kingdom
18749 Posts

Posted - Dec 13 2022 :  08:43:36 AM  Show Profile  Reply with Quote
Apologies for the slow reply. Can you please try making a new, default C++ console solution, and adding the following very simple test case to the cpp file, and see what happens:

class simpleTestClass
{
private:
	int m_nSimpleHeight;
	int m_nSimpleWidth;

public:
	simpleTestClass() : m_nSimpleHeight(-1), m_nSimpleWidth(-1) { }
	simpleTestClass(int nSimpleHeight, int nSimpleWidth);
};

void testingAutoMakeUnique()
{
	auto newTemplateAuto = std::make_unique<simpleTestClass>();
	std::unique_ptr<simpleTestClass> newTemplateExplicit = std::make_unique<simpleTestClass>();
	newTemplateAuto;
	newTemplateExplicit;
}

for me, when typing a dot after both "newTemplateAuto" and "newTemplateExplicit" the dot is converted to -> and the correct listbox appears. The reason for trying this in a new test project is to see if this is a solution specific problem for you, or if it is happening everywhere.

My first guess is that something further up your current file is confusing our parser, and causing you to get the wrong result here. But if so that something might be local to the file, it might be in a widely used header file, or it could even be in one of your stable include directories.

Does VA work out the right type for auto in other situations, or is this specific to just a few types?

zen is the art of being at one with the two'ness
Go to Top of Page

narjazz96
New Member

Romania
5 Posts

Posted - Dec 17 2022 :  11:52:28 AM  Show Profile  Reply with Quote
Hi feline,

I've had VA reparse my project and now the issue is fixed.
I've tested the same issue but instead of using auto var = ... I've used
auto var{ ... } (braced initialization) and it seams that
VA fails to deduce the auto or show any suggestions for var-> or var.
for when using braced initialization.

Thanks,
Narcis Balan

Go to Top of Page

feline
Whole Tomato Software

United Kingdom
18749 Posts

Posted - Dec 19 2022 :  05:16:49 AM  Show Profile  Reply with Quote
Unfortunately our parser doesn't currently understand brace initialization in the form:

auto var { ... }

this came up a couple of days ago, and I didn't even know you could do that when I first saw the code:

case=141519

To me this code looks like a std::initializer list, and in fact gets compiled as one in one early version of Visual Studio.

zen is the art of being at one with the two'ness
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