Valid octal C23 prefixes 0o and 0O report error 19
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 65/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Active
- Tech stack
- cpp, typescript
- Domain
- devtools
Research direction
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.
Written by the indexing model from the issue text.
Description
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
- Dominant language
- TypeScript
- Stars
- 6.2k
- Forks
- 1.7k
- Avg merge
- 1d 17h
- Merged PRs (30d)
- 12
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from microsoft/vscode-cpptools
-
Missing gcc __builtin_stdc_bit_width/floor/ceil signature makes intellisense wrongly report error 70Open
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
microsoft/vscode-cpptools#14874 ·
Maintainers usually reply within 1 day
-
Difficulty 4/5 3-5 days Newbie friendliness 56/100
microsoft/vscode-cpptools#14871 ·
Maintainers usually reply within 1 day
-
debugger
Difficulty 4/5 3-5 days Newbie friendliness 45/100
microsoft/vscode-cpptools#14869 · 1 comment ·
Maintainers usually reply within 1 day
-
Goto definition (F12) not working with (recursive) includesPossibly taken @Colengms claimed this 5 days ago. Openbug fixed Language Service
microsoft/vscode-cpptools#14868 · 2 comments · 1 reaction · 1 assignee ·
Maintainers usually reply within 1 day
-
Support for new "!" file exclusion syntaxPossibly taken @Colengms claimed this 5 days ago. Openbug Language Service
microsoft/vscode-cpptools#14867 · 4 comments · 1 assignee ·
Maintainers usually reply within 1 day
All issues in microsoft/vscode-cpptools
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
tintinweb/pi-subagents#459 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
danielmiessler/LifeOS#2830 ·
Maintainers usually reply within 6 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
freshframework/fresh#3920 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day
-
area: client enhancement priority: low
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
opensro-dev/opensro#3681 ·
Maintainers usually reply within 1 day