Skip to content

Incorrect "incomplete type "A" is not allowed C/C++(70)" message #13044

@schattenmann80

Description

@schattenmann80

Environment

  • OS and Version: win11

  • VS Code Version:
    Version: 1.95.3 (user setup)
    Commit: f1a4fb101478ce6ec82fe9627c43efbf9e98c813
    Date: 2024-11-13T14:50:04.152Z
    Electron: 32.2.1
    ElectronBuildId: 10427718
    Chromium: 128.0.6613.186
    Node.js: 20.18.0
    V8: 12.8.374.38-electron.0
    OS: Windows_NT x64 10.0.22631

  • C/C++ Extension Version: v1.22.11

  • If using SSH remote, specify OS of remote machine: debian 12

Bug Summary and Steps to Reproduce

example.zip
Bug Summary:

Steps to reproduce:

  1. Create header file test.h with a struct A and include a comment with the char: ä or ö
 * test struct with: ä
 */

struct A
{
	int a1;
	long a2;
	char a3;
	bool a4;
};
  1. Save header file in the encoding ISO 8859-15 ( Set vscode setting: "files.encoding": "iso885915" )
  2. Create source file test.cpp, save it in encoding "ISO 8859-15", include test.h and use the struct A
#include <test.h>

int main( int argc, char** argv )
{
	A a;
	a.a1 = 1;

	return a.a1;
}
  1. Close test.h and restart Inteliisense for active file
  2. The following error appears: "incomplete type "A" is not allowedC/C++(70)"

If test.h is open the error does not appear.

I suspect that the error is some encoding releated problem.

if I change the encoding of the files to UTF-8 the error does not appear.

Expected behavior:
No error should appear.

Configuration and Logs

-------- Diagnostics - 11.12.2024, 15:26:31
Version: 1.22.11
Current Configuration:
{
    "name": "Linux",
    "includePath": [
        "/home/hmr/test-repo/**"
    ],
    "defines": [],
    "compilerPath": "/usr/bin/gcc",
    "cStandard": "c17",
    "cppStandard": "gnu++17",
    "intelliSenseMode": "linux-gcc-x64",
    "compilerPathInCppPropertiesJson": "/usr/bin/gcc",
    "intelliSenseModeIsExplicit": false,
    "cStandardIsExplicit": false,
    "cppStandardIsExplicit": false,
    "mergeConfigurations": false,
    "compilerPathIsExplicit": false,
    "browse": {
        "path": [
            "/home/hmr/test-repo/**",
            "${workspaceFolder}"
        ],
        "limitSymbolsToIncludedHeaders": true
    }
}
Additional Tracked Settings:
{
    "editorTabSize": 4,
    "editorInsertSpaces": false,
    "editorAutoClosingBrackets": "languageDefined",
    "filesEncoding": "iso885915",
    "filesAssociations": {},
    "filesExclude": {
        "**/.git": true,
        "**/.svn": true,
        "**/.hg": true,
        "**/CVS": true,
        "**/.DS_Store": true,
        "**/Thumbs.db": true
    },
    "filesAutoSaveAfterDelay": false,
    "editorInlayHintsEnabled": true,
    "editorParameterHintsEnabled": true,
    "searchExclude": {
        "**/node_modules": true,
        "**/bower_components": true,
        "**/*.code-search": true
    },
    "workbenchSettingsEditor": "ui"
}
cpptools version (native): 1.22.11.0
Current database path: /home/hmr/.cache/vscode-cpptools/62cdf2c8a68edbe968cb6f56c2ec1fc9/.browse.VC.db
Translation Unit Mappings:
[ /home/hmr/test-repo/abc/src/test.cpp - source TU]:
Translation Unit Configurations:
[ /home/hmr/test-repo/abc/src/test.cpp ]
    Process ID: 25164
    Memory Usage: 16 MB
    Compiler Path: /usr/bin/gcc
    Includes:
        /home/hmr/test-repo/include
    System Includes:
        /usr/include/c++/12
        /usr/include/x86_64-linux-gnu/c++/12
        /usr/include/c++/12/backward
        /usr/lib/gcc/x86_64-linux-gnu/12/include
        /usr/local/include
        /usr/include/x86_64-linux-gnu
        /usr/include
    Standard Version: c++17
    IntelliSense Mode: linux-gcc-x64
    Other Flags:
        --g++
        --gnu_version=120200
Total Memory Usage: 16 MB

------- Workspace parsing diagnostics -------
Number of files discovered (not excluded): 3324
Number of files parsed: 1

Other Extensions

No response

Additional context

if i downgrade to 1.21.6 the error does not appear.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Language ServiceVerified - InternalVerified issue reproducesbugduplicatefixedCheck the Milestone for the release in which the fix is or will be available.regressionA bug that didn't exist in a previous releaseworld readyAn issue relating string character encodings, localization translations, etc.

    Type

    Projects

    Status

    Done

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions