SlickEdit Product Discussion > SlickEdit®

type with auto and dynamic_cast<> not determined - C++

(1/5) > >>

rowbearto:
In the below code SE should determine that the type of derivedClassObj should be DerivedClass*, but it says 'name' instead.

See "PROBLEM" in the code below.

This is with 26.0.1 on Linux x64.


--- Code: ---class BaseClass
{
    BaseClass() {};
    virtual void someVirtualFunc() {};
};

class DerivedClass : public BaseClass
{
};

BaseClass *funcThatReturnsBaseClassPtr()
{
    return nullptr;
}

void func()
{
    // PROBLEM: Do "Preview" on derivedClassObj, its type should be inferred
    // to DerivedClass*, but it says 'name'
    auto derivedClassObj = dynamic_cast<DerivedClass*>(funcThatReturnsBaseClassPtr());
}


--- End code ---

Dennis:
I can not reproduce this with 26.0.1 with the given sample.  There must be something missing -- otherwise, I do not know where 'name' came from.

rowbearto:
Look on support for case number: "rowbearto_user_cfg_xml". Maybe my user.cfg.xml is the missing piece?

When I retried it just now with this user.cfg.xml I'm getting the following preview window for the type:


--- Code: ---auto=dynamic_cast<DerivedClass*>( funcThatReturnsBaseClassPtr( ) )
--- End code ---

I changed my user.cfg.xml since I submitted this post, don't know why the result would change.

rowbearto:
After closing my SE workspace and trying again with no SE workspace, now it is saying the type is "char*".

Dennis:
char* ??

Could you try in a clean default config?  You will need to enable the option to evaluate the type in Preview.

vs +new -sc C:\Temp\defcon1\

Navigation

[0] Message Index

[#] Next page

Go to full version