Skip to content

using statement drops function qualifiers #13753

Open
@RabbitSeries

Description

@RabbitSeries

Environment

  • OS and Version: 10.0.26100 N/A Build 26100
  • VS Code Version: 1.101.2 2901c5ac6db8a986a5666c3af51ff804d05af0d4 x64
  • C/C++ Extension Version: [email protected]
  • 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

Metadata

Metadata

Assignees

Type

Projects

Status

No status

Relationships

None yet

Development

No branches or pull requests

Issue actions