Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
 All Forums
 Visual Assist
 Technical Support
 auto types are not parsed by VA

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
narjazz96 Posted - Dec 06 2022 : 08:00:25 AM
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.

3   L A T E S T    R E P L I E S    (Newest First)
feline Posted - Dec 19 2022 : 05:16:49 AM
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.
narjazz96 Posted - Dec 17 2022 : 11:52:28 AM
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

feline Posted - Dec 13 2022 : 08:43:36 AM
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?

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