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

c++20 is incorrectly used as the default cppStandard with g++-10 #5536

Closed
selectstriker2 opened this issue May 20, 2020 · 4 comments
Closed

c++20 is incorrectly used as the default cppStandard with g++-10 #5536

selectstriker2 opened this issue May 20, 2020 · 4 comments

Comments

@selectstriker2
Copy link

@selectstriker2 selectstriker2 commented May 20, 2020

Type: LanguageService

Can't use module for a variable name when C++ Standard has not been selected

  • OS and Version: Windows 10 10.0.17763
  • VS Code Version: 1.45.1
  • C/C++ Extension Version: 0.28.0
  • Single file in workspace

Steps to reproduce

module.cpp

class Module
{
private:
    int module;
public:
    Module(int module);
    ~Module();
};

Module::Module(int module)
{
    //module expects a ')'
}

c_cpp_properties.json

{
    "configurations": [
        {
            "name": "Win32",
            "includePath": [
                "${workspaceFolder}/**"
            ],
            "defines": [
                "_DEBUG",
                "UNICODE",
                "_UNICODE"
            ]
        }
    ],
    "version": 4
}

Expected behavior
Expect to variable names of module to not be identified as errors

Logs
-------- Diagnostics - 5/20/2020, 10:21:28 AM
Version: 0.28.0
Current Configuration:
{
    "name": "Win32",
    "includePath": [
        "${workspaceFolder}/**"
    ],
    "defines": [
        "_DEBUG",
        "UNICODE",
        "_UNICODE"
    ],
    "compilerPath": "C:\\msys64\\mingw32\\bin",
    "compilerArgs": [],
    "intelliSenseMode": "gcc-x86",
    "browse": {
        "path": [
            "${workspaceFolder}/**"
        ],
        "limitSymbolsToIncludedHeaders": true
    }
}
Translation Unit Mappings:
[ C:\Keny\Projects\VSCode Issues\module.cpp ]:
    C:\KENY\PROJECTS\VSCODE ISSUES\MODULE.CPP
Translation Unit Configurations:
[ C:\Keny\Projects\VSCode Issues\module.cpp ]:
    Process ID: 10264
    Memory Usage: 15 MB
    Compiler Path: C:\msys64\mingw32\bin\gcc.exe
    Includes:
        C:\MSYS64\MINGW32\INCLUDE\C++\10.1.0
        C:\MSYS64\MINGW32\INCLUDE\C++\10.1.0\I686-W64-MINGW32
        C:\MSYS64\MINGW32\INCLUDE\C++\10.1.0\BACKWARD
        C:\MSYS64\MINGW32\LIB\GCC\I686-W64-MINGW32\10.1.0\INCLUDE
        C:\MSYS64\MINGW32\INCLUDE
        C:\MSYS64\MINGW32\LIB\GCC\I686-W64-MINGW32\10.1.0\INCLUDE-FIXED
        C:\MSYS64\MINGW32\I686-W64-MINGW32\INCLUDE
    Defines:
        _DEBUG
        UNICODE
        _UNICODE
    Standard Version: c++20
    IntelliSense Mode: gcc-x86
    Other Flags:
        --g++
        --gnu_version=100100
Total Memory Usage: 15 MB
@sean-mcmanus
Copy link

@sean-mcmanus sean-mcmanus commented May 20, 2020

There are 2 issues:

  1. We're incorrectly setting the default to c++20 for g++-10 instead of gnu++14.
  2. There's an IntelliSense bug with c++20 mode in regards to the usage of "modules". I'll move that to a new bug.

The workaround is to set the cppStandard to a version less than c++20.

c18 is also used as the default for .c files, which is also incorrect (should be gnu11).

@sean-mcmanus sean-mcmanus added this to Triage in 0.29.0 via automation May 20, 2020
@sean-mcmanus sean-mcmanus added this to the 0.29.0 milestone May 20, 2020
@sean-mcmanus sean-mcmanus moved this from Triage to To Do in 0.29.0 May 20, 2020
@sean-mcmanus sean-mcmanus changed the title Can't use module for a variable name when C++ Standard has not been selected c++20 is incorrectly used as the default cppStandard with g++-10 May 20, 2020
@sean-mcmanus
Copy link

@sean-mcmanus sean-mcmanus commented May 21, 2020

Actually, I believe the usage of c++20 is "by design" because we try to use the highest standard version the compiler supports, but we may want to change that design to either use the actual default or excluding c++20 since the support is not complete yet.

Setting C_Cpp.default.cppStandard should be a workaround.

@ghuser404
Copy link

@ghuser404 ghuser404 commented Jun 1, 2020

@sean-mcmanus Everyone expects IntelliSense to match compiler behaviour. Using actual default will make more sense.

@bobbrow bobbrow moved this from To Do to On Deck in 0.29.0 Jun 11, 2020
@sean-mcmanus
Copy link

@sean-mcmanus sean-mcmanus commented Jun 12, 2020

This seems fixed already in 0.28.3. Let me know if you can still repro it.

@sean-mcmanus sean-mcmanus removed this from On Deck in 0.29.0 Jun 12, 2020
@sean-mcmanus sean-mcmanus removed this from the 0.29.0 milestone Jun 12, 2020
@sean-mcmanus sean-mcmanus added this to the 0.28.1 milestone Jun 12, 2020
@sean-mcmanus sean-mcmanus removed their assignment Jun 12, 2020
@github-actions github-actions bot locked and limited conversation to collaborators Oct 8, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants