Skip to content

Autocomplete does not work for objects marked const #11276

@baskuit

Description

@baskuit

Environment

  • OS and Version: Ubuntu 23.04
  • VS Code Version: 1.79.0
  • C/C++ Extension Version: 1.16.3

Bug Summary and Steps to Reproduce

Bug Summary:

Normally if you instantiate an object that has some constrains on members and methods, those members and methods will autofill. This does not happen if the object in marked const.

I'm using GCC 13.0.1 x86_64. The following code is a minimal example.

#include <concepts>
struct Types
{
    struct Real
    {
        void reduce() const {}
    };
};

template <typename Real>
concept IsReal = 
requires (const Real real) {
    {
        real.reduce()
    } -> std::same_as<void>;
};

template <IsReal Real>
struct Foo {
    Foo () {
        Real real; 
        real.reduce(); // this will autocomplete
        const Real const_real;
        const_real.reduce(); // this will NOT autocomplete
    }
};

int main()
{
    Foo<Types::Real> {};
}

Configuration and Logs

I don't have a c_cpp_properties.json in my .vscode directory. Only a settings.json, and the only field besides file associations is 

"C_Cpp.default.compilerPath": "/usr/bin/gcc-13"


### Other Extensions

_No response_

### Additional context

_No response_

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions