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

未關閉
#14,872 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

維護者通常 1 天內回覆

還沒有人認領這個 Issue。

評估

難度
3/5
預估耗時
1-2 天
新手友好度
65/100
Issue 類型
缺陷
描述清晰度
基本清楚
活躍度
活躍
技術堆疊
cpp, typescript
領域
devtools

研究方向

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.

由索引模型根據 Issue 內容生成。

描述

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

主要語言
TypeScript
星號
6.2k
分支
1.7k
平均合併
1 天 17 小時
30 天內合併 PR
12

環境準備

  • 沒有 Dockerfile 或 Docker Compose 檔案
  • 沒有 Pull Request 範本
  • 閱讀貢獻指南

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

microsoft/vscode-cpptools 的其他 Issue

查看 microsoft/vscode-cpptools 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。