Public members of private base class show in autocomplete list

Đang mở
#13,215 0 bình luận 1 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
45/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
cpp, typescript, vscode
Lĩnh vực
devtools

Hướng nghiên cứu

Tái hiện vấn đề trong một tệp .cpp độc lập bằng cách sử dụng các lớp A và B được minh họa, sau đó lần theo điểm bắt đầu lọc thành viên của tính năng tự động hoàn thành trong extension C/C++. Bản sửa được hoàn tất khi các thành viên public được kế thừa thông qua một lớp cơ sở private bị loại bỏ bên ngoài lớp dẫn xuất, trong khi các thành viên có thể truy cập vẫn khả dụng.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

bug Feature: Auto-complete Language Service Works in VS
Environment
  • OS and Version: Windows 10 Pro, 22H2, 19045.5371
  • VS Code Version: 1.96.4 (user setup)
  • C/C++ Extension Version: 1.23.5
  • If using SSH remote, specify OS of remote machine: No SSH
Bug Summary and Steps to Reproduce

Bug Summary:
When the autocomplete list for members of a class shows while typing, public members (fields, methods, enums, etc.) from private base classes will show in the list as if the the base class was public, despite them being inaccessible outside of the derived class.

Steps to reproduce:

  1. Create a standalone .cpp file without any extension or workplace-specific settings.
  2. Create a class that privately inherits from a base class.
  3. In a function (not a method of the derived class) with a local variable of this derived class, open the autocomplete list by typing . after the name.
  4. Public members of base class will show in the list, even though it is private.
class A {
public:
    int value;
};

class B : private A {};

void foo() {
    B b;
    // Typing here: `value` member is visible in list that pops up.
    b.
}

Image

Expected behavior:
Public members of a private base class should not appear in the autocomplete list in a scope where they can't be used, just like how is done with normal private/protected members.

Configuration and Logs
"C_Cpp.autoAddFileAssociations": false,
Other Extensions

Issue persists after disabling all other extensions and reloading window.

Additional context

No response

Ngôn ngữ chính
TypeScript
Star
6.2k
Fork
1.7k
Merge trung bình
14 giờ 46 phút
Pull request đã merge (30 ngày)
61

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của microsoft/vscode-cpptools

Tất cả issue của microsoft/vscode-cpptools

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.