microsoft / microsoft/vscode-cpptools

using statement drops function qualifiers

Open
#13,753 1 comment 0 reactions 1 assignee View on GitHub

@sean-mcmanus is already working on this.

Since Jul 10, 2025.

bug Language Service parser Visual Studio
Dominant language
TypeScript
Stars
6.2k
Forks
1.7k
Avg merge
14h 46m
Merged PRs (30d)
61

Description

Environment
  • OS and Version: 10.0.26100 N/A Build 26100
  • VS Code Version: 1.101.2 2901c5ac6db8a986a5666c3af51ff804d05af0d4 x64
  • C/C++ Extension Version: ms-vscode.cpptools@1.26.3
  • If using SSH remote, specify OS of remote machine: NONE
Bug Summary and Steps to Reproduce

Bug Summary:

Image Image

Expected behavior:
Qualifiers are not dropped.

Configuration and Logs
{
    "configurations": [
        {
            "name": "Win32",
            "includePath": [
                "${workspaceFolder}/**"
            ],
            "defines": [
                "_DEBUG",
                "UNICODE",
                "_UNICODE"
            ],
            "compilerPath": "D:\\Build_Tool_Lib\\x86_64-15.1.0-release-win32-seh-msvcrt-rt_v12-rev0\\mingw64\\bin\\gcc.exe",
            "cStandard": "c23",
            "cppStandard": "c++23",
            "intelliSenseMode": "windows-gcc-x64"
        }
    ],
    "version": 4
}
Other Extensions

No response

Additional context

Code:

#include <functional>
#include <iostream>
#include <tuple>
#include <type_traits>

template <typename F>
struct func_trait {};

template <typename F, typename C>
struct func_trait<F C::*> {
    using function_type = F;
};

template <typename F>
using func_trait_t = typename func_trait<F>::function_type;

struct inner_product {
    int member_func( int int_arg, int const& c_int_arg ) /* const qualified */ const { return 0; }
};

using const_type = int( int ) const;
using const_vol_type = int( int ) const volatile; // both exhibits int(int)

int main() {
    static_assert( std::is_same_v<decltype( &inner_product::member_func ), int ( inner_product::* )( int, int const& ) const> );  // true
    static_assert( std::is_function_v<func_trait_t<decltype( &inner_product::member_func )>> );                                   // true, but intellisense is wrong
    static_assert( std::is_same_v<func_trait_t<decltype( &inner_product::member_func )>, int( int, int const& ) const> );         // true, but intellisense is wrong

    static_assert( std::is_same_v<func_trait_t<decltype( &inner_product::member_func )>, int( int, int const& )> );  // this fails as expected, but intellisense is wrong


    func_trait_t<decltype( &inner_product::member_func )> obj;  // surely type is qualified and obj is not valid
                                                                // but intellisense is also wrong
}

Edit:
After some experment, this static assert is not working as expected:

Image

\
\
But compilation works

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.