SlickEdit Community

SlickEdit Product Discussion => SlickEdit® => Topic started by: rowbearto on January 12, 2022, 10:38:50 pm

Title: The data type of an 'auto' is not properly figured out by SE in C++
Post by: rowbearto on January 12, 2022, 10:38:50 pm
See example below, look for "PROBLEM:"

This issue occurs on 26.0.1 Linux x64.

Code: [Select]
namespace some_namespace
{
    class SomeContext
    {
    public:
        template <class T> T* create(void* ptr, long long identifier = 0)
        {
            T* valToReturn = nullptr;
            return valToReturn;
        }
    }
    class SomeContext : public some_namespace::SomeContext
    {
    public:
        int xelem1;
        int xelem2;
    }
  }
};

using namespace some_namespace;

class ClassName2
{
public:
    int elem1;
    int elem2;
};

void somefunc(SomeContext& someContextObj)
{
    auto createdObj = someContextObj.create<ClassName2>(nullptr, 0);

    // PROBLEM:
    // Using "Preview" window on createdObj below shows that SlickEdit
    // thinks the type of "createdObj" is someContextObj.create<ClassName2>( nullptr, 0 )
    // but this is not correct. The type of createdObj should be "ClassName2 *"
    // Also doing -> after createdObj doesn't autolist, probably related to the
    // type of createdObj not getting properly determined.
    createdObj->;
}
Title: Re: The data type of an 'auto' is not properly figured out by SE in C++
Post by: Dennis on January 13, 2022, 01:27:55 pm
Reproduced.  The problem traces down to the template function.  We handle template replacement somewhat well with classes, but not as good with template functions.  I'll take a look at it.  Thanks for the good test case.
Title: Re: The data type of an 'auto' is not properly figured out by SE in C++
Post by: Dennis on March 28, 2022, 10:21:49 pm
There will be a fix for 26.0.2 which should help with cases like this.