Skip to content

typeof incorrectly removes qualifiers in some situations (with C clang/gcc modes) #13613

Open
@Halalaluyafail3

Description

@Halalaluyafail3

Environment

  • OS and Version: Windows 10
  • VS Code Version: 1.100.2
  • C/C++ Extension Version: 1.25.3

Bug Summary and Steps to Reproduce

Bug Summary:

Steps to reproduce:
Use typeof with a qualified or atomic lvalue obtained from dereferencing a pointer to a qualified or atomic type, for example:

typedef typeof(*(const int*)0)x;

When hovering over this definition, it reports x as being the type int.

Expected behavior:
The reported type of x should be const int.

Configuration and Logs

{
	"configurations": [
		{
			"name": "Win32",
			"includePath": [
				"${workspaceFolder}/**"
			],
			"defines": [
				"_DEBUG",
				"UNICODE",
				"_UNICODE"
			],
			"cStandard": "c23",
			"cppStandard": "c++23",
			"intelliSenseMode": "linux-gcc-x64",
			"compilerPath": "C:/cygwin64/bin/gcc.exe"
		}
	],
	"version": 4
}

Other Extensions

No response

Additional context

Image

This issue does not occur when using an lvalue derived from a name instead of dereferencing a pointer, e.g.:

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    Status

    No status

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions