Valid octal C23 prefixes 0o and 0O report error 19

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

Maintainer thường phản hồi trong vòng 1 ngày

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

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
65/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
cpp, typescript
Lĩnh vực
devtools

Hướng nghiên cứu

Start by reproducing the report in VS Code with the supplied octal.c example, then trace how the C/C++ extension diagnoses numeric literals in C23 mode. Check that 0o640 and 0O640 no longer produce error 19 while the existing 0640 case still works; the issue names no source files or tests, so locate the relevant parser or diagnostic tests first.

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

Mô tả

Environment
  • OS and Version: Linux 7.2.14-arch1-1
  • VS Code Version: 1.145.2
  • C/C++ Extension Version: v1.35.6
Bug Summary and Steps to Reproduce

Bug Summary:
The number octal prefixes 0o and 0O wrongly report an error in the editor, even appearing in the 'Problems' tab. Even though this is supported since C23 and it compiles fine.
The error is: extra text after expected end of number C/C++(19)

To reproduce, create an octal.c file in vscode and paste:

#include <stdio.h>

int main(){
	int octal_number0 = 0640; // old school (deprecated in C2y/C29 draft) octal prefix works fine
	int octal_number1 = 0o640; // error 19 reported
	int octal_number2 = 0O640;

	printf("%#x\n", octal_number0); // prints "0x1a0"
	printf("%#x\n", octal_number1); // prints "0x1a0"
	printf("%#x\n", octal_number2); // prints "0x1a0"

	return 0;
}

Compiling with clang -g -Wall -Wextra -std=c23 octal.c -o octal && ./octal works without any error or warning
If you compile with -std=c2y instead, you get a deprecation warning for the 0 prefix, but the other two are still fine

Configuration and Logs
None
Other Extensions

No response

Additional context

No response

Ngôn ngữ chính
TypeScript
Star
6.2k
Fork
1.7k
Merge trung bình
1 ngày 17 giờ
Pull request đã merge (30 ngày)
12

Chuẩn bị môi trường

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.