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

Aperta
#14,872 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
65/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
cpp, typescript
Ambito
devtools

Direzione di ricerca

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.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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

Lingua principale
TypeScript
Stelle
6.2k
Fork
1.7k
Merge medio
1g 17h
PR unite (30g)
12

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di microsoft/vscode-cpptools

Tutte le issue di microsoft/vscode-cpptools

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.