Skip to content

IntelliSense: False positive error message for std::unique_ptr return type #11979

Closed

Description

@nanlour

Environment

  • OS and Version: Ubuntu 22.04.3 LTS
  • VS Code Version:
  • C/C++ Extension Version: v1.19.3 (pre-release)
  • If using SSH remote, specify OS of remote machine: None

Bug Summary and Steps to Reproduce

Bug Summary:
Screenshot from 2024-02-18 20-35-10
The code work fine, but for line 14, I got error message: function "std::unique_ptr<_Tp, _Dp>::unique_ptr(const std::unique_ptr<_Tp, _Dp> &) [with _Tp=int, _Dp=std::default_delete]" (declared at line 468 of "/usr/include/c++/11/bits/unique_ptr.h") cannot be referenced -- it is a deleted functionC/C++(1776).

I think when return, the unique pointer are tread as rvalue to construct return type fool, but IntelliSense think it is lvalue.

Expected behavior:
No error message.

Configuration and Logs

{
    "configurations": [
        {
            "name": "Linux",
            "includePath": [
                "${workspaceFolder}/**"
            ],
            "defines": [],
            "cStandard": "c17",
            "cppStandard": "c++17",
            "intelliSenseMode": "linux-gcc-x64"
        }
    ],
    "version": 4
}

Other Extensions

No response

Additional context

No response

Activity

  1. sean-mcmanus commented on Feb 20, 2024

    @sean-mcmanus
    Contributor
  2. moved this from Triage to No status in cpptoolson Jun 20, 2024
  3. added
    fixedCheck the Milestone for the release in which the fix is or will be available.
    on Jan 8, 2025
  4. sean-mcmanus commented on Jan 10, 2025

    @sean-mcmanus
    Contributor
  5. locked and limited conversation to collaborators on Mar 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Language ServiceVisual StudioInherited from Visual StudiobugfixedCheck the Milestone for the release in which the fix is or will be available.

    Type

    Projects

    • Status
      Done

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions