microsoft / microsoft/vscode-cpptools
Incorrect intelliSense errors depending on include order
まだ誰も着手していません。
- 主要言語
- TypeScript
- スター
- 6.2k
- フォーク
- 1.7k
- 平均マージ
- 14時間 46分
- マージ済み PR(30日)
- 61
説明
Bug type: Language Service
Describe the bug
- OS and Version: Windows 10 21H2
- VS Code Version: 1.68.1
- C/C++ Extension Version: 1.10.7
- A clear and concise description of what the bug is, including information about the workspace (i.e. is the workspace a single project or multiple projects, size of the project, etc).
I've got the following two files, using IAR Systems standard library headers:
// main.cpp
#include <stdint.h>
#include <wchar.h>
#include <memory>
#include "header.hpp"
int main() {
auto b = ns::B(1);
}
// header.hpp
#pragma once
namespace ns {
class B {
public:
explicit B(const int& a) {}
};
}
In main.cpp, intelliSense incorrectly complains that the namespace ns does not exist:

If I open header.hpp, where ns is defined, and go back to main.cpp, the error disappears for a while. If I browse some other files for a while, the error reappears.
Interestingly, the problem only occurs when <memory> is included last of the standard library headers. Removing any of the includes or including <memory> earlier gets rid of the intelliSense error. main.cpp compiles correctly in all cases.
Steps to reproduce
Here is an example that reproduces the problem:
cpptools_errors_from_include_order_example.zip
It includes all the necessary files, including the c_cpp_properties.json and all required IAR standard library headers.
Simply open main.cpp and observe the intelliSense error.
Additional context
This may be related to https://github.com/microsoft/vscode-cpptools/issues/9170. The symptoms are similar, but the workaround of disabling the cache size limit did not work for me.
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
提供された cpptools_errors_from_include_order_example.zip を開き、main.cpp、header.hpp、c_cpp_properties.json、IAR ヘッダーを調査します。まず、 を最後にインクルードした状態で、ns に関する誤ったエラーを再現します。完了条件は、提供された例について IntelliSense が ns が存在しないと報告しなくなり、プロジェクトが引き続き正常にコンパイルできることです。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- cpp, typescript, vscode
- 領域
- developer-experience, devtools
- issue の種類
- バグ
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 35/100