microsoft / microsoft/vscode-cpptools

IntelliSense for clang-cl produces incorrect error with boost::function

Open
#6,473 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Type: LanguageService

Describe the bug

  • OS and Version: Windows 10 Pro 1909
  • VS Code Version: 1.51.0
  • C/C++ Extension Version: 1.1.0

When I specify the path to clang-cl.exe to compilerPath property of c_cpp_properties.json, incorrect errors appear in the problems window. Using boost::function is an easy way to reproduce it.

Steps to reproduce

  1. Make sure you have installed Clang 9.0.0 for Windows
  2. Download Boost 1.73.0 from https://www.boost.org and extract it somewhere
  3. Create a directory
  4. Put test.cpp in the directory
#include <boost/function.hpp>

void f(const boost::function<void()> &x) {
    x();
}
  1. Put .vscode/c_cpp_properties.json
{
    "version": 4,
    "configurations": [
        {
            "name": "Clang",
            "compilerPath": "C:/Program Files/LLVM/bin/clang-cl.exe",
            "includePath": [
                "C:/your/path/to/boost_1_73_0"
            ]
        }
    ]
}
  1. Open the directory with VSCode
  2. Open test.cpp with the editor

Expected behavior

No error is shown in the problems window. You can get this result by specifying clang.exe instead of clang-cl.exe.

Actual behavior

The following error is shown in the problems window.

call of an object of a class type without appropriate operator() or conversion functions to pointer-to-function type

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

Reproduce the diagnostic with the provided test.cpp, Boost 1.73.0, and .vscode/c_cpp_properties.json using clang-cl.exe, then compare it with clang.exe. Trace the IntelliSense language-service handling of the compilerPath setting; done means the boost::function example produces no Problems-window error with clang-cl.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, vscode
Domain
compilers, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.