Skip to content

VSCode incorrectly reports namespaced base class std::unique_ptr assignment as error #1559

@Anketell

Description

@Anketell

OS: Ubuntu 16.04 LTS
VSCode ver: 1.20.0
C/C++ Ext ver: 0.14.6

  1. Enter the following code into an editor and save.
#include <memory>

namespace b
{
    class Base
    {
    };
}

namespace d
{
    class Derived : public b::Base
    {
    };
}

int main( void )
{
    auto p = std::make_unique< d::Derived >();

    std::unique_ptr< b::Base > q = std::move( p );

    return 0;
}

VSCode incorrectly reports the error:

no suitable user-defined conversion from "std::unique_ptr<d::Derived, std::default_delete<d::Derived>>" to "std::unique_ptr<b::Base, std::default_delete<b::Base>>" exists

Whereas without the namespaces VSCode correctly reports no error.

#include <memory>

class Base
{
};

class Derived : public Base
{
};

int main( void )
{
    auto p = std::make_unique< Derived >();

    std::unique_ptr< Base > q = std::move( p );

    return 0;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugfixedCheck the Milestone for the release in which the fix is or will be available.parser

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions