Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Various issue with gcc-13 due to unchecked __is_convertible built-in in system headers (is_convertible_v) #11038

Closed
felix-leg opened this issue Jun 1, 2023 · 4 comments
Labels
bug fixed Check the Milestone for the release in which the fix is or will be available. gcc 13 Language Service
Milestone

Comments

@felix-leg
Copy link

felix-leg commented Jun 1, 2023

Environment

  • OS and Version: Linux 6.3.5-zen1-1-zen
  • VS Code Version: April 2023 (version 1.78)
  • C/C++ Extension Version: v1.16.0

Bug Summary and Steps to Reproduce

Bug Summary:
Intellisense marks a correct C++20 code with the error no != operator matches these operands .

Steps to reproduce:

  1. Enter the below code:
#include <iostream>
#include <string>

int main (int argc, char **argv)
{
    std::string str = "Hello";
    for(auto c : str) {}
    return 0;
}
  1. Wait for Intellisense to catch up
  2. Intellisense highlights the for loop with error:
[{
	"owner": "C/C++: IntelliSense",
	"code": "349",
	"severity": 8,
	"message": "no \"!=\" operator matches these operands",
	"source": "C/C++",
	"relatedInformation": [
		{
			"message": "operand types: __gnu_cxx::__normal_iterator<const char *, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>> != __gnu_cxx::__normal_iterator<const char *, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>"
		}
	]
}]

Expected behavior:

Intellisense shouldn't highlight the code

Configuration and Logs

c_cpp_properties.json:

{
    "configurations": [
        {
            "name": "Linux",
            "includePath": [
                "${workspaceFolder}/src"
            ],
            "defines": [
            ],
            "compilerPath": "/usr/bin/gcc",
            "cStandard": "gnu11",
            "cppStandard": "c++20",
            "intelliSenseMode": "gcc-x64",
            "configurationProvider": "ms-vscode.cmake-tools",
            "compileCommands": "${workspaceFolder}/build/compile_commands.json"
        }
    ],
    "version": 4
}

Diagnostics:

-------- Diagnostics - 1.06.2023, 14:04:23
Version: 1.16.0
Current Configuration:
{
    "name": "Linux",
    "includePath": [
        ".../src"
    ],
    "defines": [
    ],
    "compilerPath": "/usr/bin/gcc",
    "cStandard": "gnu11",
    "cppStandard": "c++20",
    "intelliSenseMode": "gcc-x64",
    "configurationProvider": "ms-vscode.cmake-tools",
    "compileCommands": ".../build/compile_commands.json",
    "compilerPathIsExplicit": true,
    "cStandardIsExplicit": true,
    "cppStandardIsExplicit": true,
    "intelliSenseModeIsExplicit": true,
    "compilerPathInCppPropertiesJson": "/usr/bin/gcc",
    "compileCommandsInCppPropertiesJson": "${workspaceFolder}/build/compile_commands.json",
    "configurationProviderInCppPropertiesJson": "ms-vscode.cmake-tools",
    "mergeConfigurations": false,
    "browse": {
        "path": [
            "${workspaceFolder}/src",
            "${workspaceFolder}"
        ],
        "limitSymbolsToIncludedHeaders": true
    }
}
Custom browse configuration: 
{
    "browsePath": [
        ".../src/file_types/json",
        ".../src/utility",
        ".../src",
        ".../src/system/sdl_low",
        ".../system/gl"
    ],
    "compilerPath": "/usr/bin/c++",
    "compilerArgs": [],
    "compilerFragments": [
        "-g -std=c++20"
    ]
}
Custom configurations:
[ .../src/file_types/json/lexer.cpp ]
{
    "includePath": [],
    "defines": [],
    "compilerPath": "/usr/bin/c++",
    "compilerArgs": [],
    "compilerFragments": [
        "-g -std=c++20"
    ]
}
Translation Unit Mappings:
[ .../src/file_types/json/lexer.cpp ]:
    .../src/file_types/json/lexer.cpp
Translation Unit Configurations:
[ .../src/file_types/json/lexer.cpp ]:
    Process ID: 24337
    Memory Usage: 299 MB
    Compiler Path: /usr/bin/c++
    Includes:
        /usr/include/c++/13.1.1
        /usr/include/c++/13.1.1/x86_64-pc-linux-gnu
        /usr/include/c++/13.1.1/backward
        /usr/lib/gcc/x86_64-pc-linux-gnu/13.1.1/include
        /usr/local/include
        /usr/lib/gcc/x86_64-pc-linux-gnu/13.1.1/include-fixed
        /usr/include
    Standard Version: c++20
    IntelliSense Mode: linux-gcc-x64
    Other Flags:
        --g++
        --gnu_version=130101
Total Memory Usage: 299 MB
Browse Paths from compile_commands.json, from workspace folder: ...
    .../src
    .../src/file_types/json
    .../src/system/gl
    .../src/system/sdl_low
    .../src/utility

------- Workspace parsing diagnostics -------
Number of files discovered (not excluded): 55664
Number of files parsed: 6369

Other Extensions

No response

Additional context

No response

@Colengms Colengms self-assigned this Jun 2, 2023
@Colengms
Copy link
Contributor

Colengms commented Jun 2, 2023

Hi @felix-leg . Thanks for reporting this. It looks like some recent changes in gcc (13) headers have exposed some IntelliSense issues.

@Colengms Colengms added bug Language Service investigate: repro This issue's repro steps needs to be investigated/confirmed labels Jun 2, 2023
@Colengms
Copy link
Contributor

Colengms commented Jun 9, 2023

It looks like this can be narrowed down to the following repro:

static_assert(std::is_convertible_v<int, int>);

This may be a gcc-13 header bug. In most places, the gcc 13 system headers are using __has_builtin to ensure certain compiler built-ins are supported before relying on them. But, for is_convertible_v, it's leveraging their new built-in without that check.

Though, it may also be possible for us to address in the C/C++ Extension by adding support for new gcc 13 built-ins.

@Colengms Colengms removed the investigate: repro This issue's repro steps needs to be investigated/confirmed label Jun 12, 2023
@Colengms Colengms added this to the 1.17 milestone Jun 12, 2023
@Colengms Colengms changed the title "no != operator matches these operands" error with a working example Various issue with gcc-13 due to unchecked __is_convertible built-in in system headers (is_convertible_v) Jun 12, 2023
@Colengms Colengms pinned this issue Jun 28, 2023
@sean-mcmanus sean-mcmanus modified the milestones: 1.17, 1.17.0 Jun 29, 2023
@bobbrow bobbrow added the fixed Check the Milestone for the release in which the fix is or will be available. label Jul 18, 2023
@michelleangela
Copy link
Contributor

Fix available in pre-release https://github.com/microsoft/vscode-cpptools/releases/tag/v1.17.0.

@michelleangela
Copy link
Contributor

@sean-mcmanus sean-mcmanus unpinned this issue Aug 15, 2023
@github-actions github-actions bot locked and limited conversation to collaborators Sep 29, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug fixed Check the Milestone for the release in which the fix is or will be available. gcc 13 Language Service
Projects
None yet
Development

No branches or pull requests

5 participants