microsoft / microsoft/vscode-cpptools

Intellisense not handling attributes for ext_vector_type

Open
#10,037 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Language Service Visual Studio
Dominant language
TypeScript
Stars
6.2k
Forks
1.7k
Avg merge
14h 46m
Merged PRs (30d)
61

Description

Environment
  • OS and version: macos12.6, M1
  • VS Code: Version: 1.72.2 (Universal)
  • C/C++ extension: C/C++ v1.13.2 (Pre-release)

c_cpp_properties.json settings that I've tried
"intelliSenseMode": "macos-gcc-arm64",
and
"intelliSenseMode": "macos-clang-arm64",

Bug Summary and Steps to Reproduce

Bug Summary:
Intellisense reports an error expression must have class type but it has type "vector4"C/C++(153) but it doesn't register as an error during compilation. Xcode does not report this code as problematic either.

Steps to reproduce:
define a vector
typedef float vector4 __attribute__((ext_vector_type(4)));

Refer to a value in the vector using (x, y, z, w) rather than indexing

vector4 V;
V.x = 1.0;

Intellisense returns
expression must have class type but it has type "vector4"C/C++(153)

Expected behavior

I don't think this should be reported as an error in Intellisense.

If the error is correct then is there something obvious that I'm missing in the c_cpp_properties.json?

Code sample and Logs
{
    "configurations": [
        {
            "name": "VectorTest",
            "includePath": [
                "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/"
            ],
            "defines": [],
            "macFrameworkPath": [
                "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks",
                "/System/Library/Frameworks",
                "/Library/Frameworks"
            ],
            "compilerPath": "/usr/bin/clang",
            "cStandard": "c89",
            "cppStandard": "c++14",
            "intelliSenseMode": "macos-clang-arm64",
            "browse": {
                "limitSymbolsToIncludedHeaders": true
            }
        }
    ],
    "version": 4
}



### Screenshots

_No response_

### Additional context

_No response_

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the diagnostic with the ext_vector_type example and the supplied c_cpp_properties.json using macos-clang-arm64. Compare IntelliSense's result with clang compilation and Xcode, then trace how the extension handles vector attributes; done means the valid member access no longer reports C/C++(153), with a regression test covering the sample.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, cpp, vscode
Domain
devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.