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

Intellisense Warnings for C++ 20 ranges #8039

Closed
sean-mcmanus opened this issue Aug 24, 2021 Discussed in #8026 · 3 comments
Closed

Intellisense Warnings for C++ 20 ranges #8039

sean-mcmanus opened this issue Aug 24, 2021 Discussed in #8026 · 3 comments
Labels
bug fixed Check the Milestone for the release in which the fix is or will be available. Language Service Visual Studio Inherited from Visual Studio
Milestone

Comments

@sean-mcmanus
Copy link
Contributor

Discussed in #8026

Originally posted by coulanuk August 21, 2021
Running the sample code for C++ 20 ranges taken from https://en.cppreference.com/w/cpp/ranges.

VSCode Intellisense warnings appear for :

  • no operator "|" matches these operands -- operand types are: std::ranges::filter_view<std::ranges::iota_view<int, int>, type> | std::ranges::views::__adaptor::_RangeAdaptorClosure
  • this range-based 'for' statement requires a suitable "begin" function and none was found

The code compiles and runs correctly.
compiler args -std=c++20 are set in tasks.json and c_cpp_properties.json.
See output of C/C++ Log Diagnostics below.
Q: Is there anything else I need to set somewhere to get a clean response from Intellisense?

  • OS : Ubuntu 20.04 (Linux x64 5.4.0-81-generic)
  • VS Code version : 1.59.0
  • Compiler : gcc 10.3.0

-------- Diagnostics - 21/08/2021, 18:27:33
Version: 1.6.0-insiders3
Current Configuration:
{
"name": "Linux",
"includePath": [
"${workspaceFolder}/**"
],
"defines": [],
"compilerPath": "/usr/bin/gcc",
"cStandard": "gnu17",
"cppStandard": "gnu++20",
"intelliSenseMode": "gcc-x64",
"compilerArgs": [
"-std=c++20",
"-g"
],
"browse": {
"limitSymbolsToIncludedHeaders": false
},
"compilerPathIsExplicit": true,
"cStandardIsExplicit": true,
"cppStandardIsExplicit": true,
"intelliSenseModeIsExplicit": true
}
Translation Unit Mappings:
[ /home/coulan/src2/cpp20/testcpp20.cpp ]:
/home/coulan/src2/cpp20/testcpp20.cpp
Translation Unit Configurations:
[ /home/coulan/src2/cpp20/testcpp20.cpp ]:
Process ID: 7926
Memory Usage: 407 MB
Compiler Path: /usr/bin/gcc
Includes:
/usr/include/c++/10
/usr/include/x86_64-linux-gnu/c++/10
/usr/include/c++/10/backward
/usr/lib/gcc/x86_64-linux-gnu/10/include
/usr/local/include
/usr/include/x86_64-linux-gnu
/usr/include
Standard Version: c++20
IntelliSense Mode: linux-gcc-x64
Other Flags:
--g++
--gnu_version=100300
Total Memory Usage: 407 MB

------- Workspace parsing diagnostics -------

@sean-mcmanus sean-mcmanus added bug Language Service Visual Studio Inherited from Visual Studio labels Aug 24, 2021
@sean-mcmanus sean-mcmanus self-assigned this Aug 24, 2021
@sean-mcmanus
Copy link
Contributor Author

I've filed an internal bug against our IntelliSense parser. The same also generates 3 other errors from the ranges header itself (which could be the root errors):

"more than one partial specialization matches the template argument list of class "std::__iterator_traits<std::ranges::filter_view<std::ranges::ref_view<const std::initializer_list>, type>::_Iterator, void>" -- "std::__iterator_traits<_Iterator, void>" -- "std::__iterator_traits<_Iterator, void>" -- detected during instantiation of class "std::iterator_traits<_Iterator> [with _Iterator=std::ranges::filter_view<std::ranges::ref_view<const std::initializer_list>, type>::_Iterator]"

"no instance of function template "std::compare_three_way::operator()" matches the argument list -- argument types are: (const std::_V2::error_category *, const std::_V2::error_category *) -- object type is: std::compare_three_way"

"no instance of function template "std::ranges::__cust_iswap::_IterSwap::operator()" matches the argument list -- argument types are: (const std::ranges::iterator_t<std::ranges::ref_view<const std::initializer_list>>, const std::ranges::iterator_t<std::ranges::ref_view<const std::initializer_list>>) -- object type is: const std::ranges::__cust_iswap::_IterSwap -- detected during instantiation of class "std::ranges::filter_view<_Vp, _Pred>::_Iterator [with _Vp=std::ranges::ref_view<const std::initializer_list>, _Pred=type]"

@sean-mcmanus sean-mcmanus removed their assignment Aug 24, 2021
@sean-mcmanus sean-mcmanus added this to the Tracking milestone Aug 24, 2021
@sean-mcmanus sean-mcmanus modified the milestones: Tracking, 1.16.0 Apr 28, 2023
@sean-mcmanus sean-mcmanus added the fixed Check the Milestone for the release in which the fix is or will be available. label May 16, 2023
@michelleangela
Copy link
Contributor

This is resolved in https://github.com/microsoft/vscode-cpptools/releases/tag/1.16.0.

@michelleangela
Copy link
Contributor

Fix is now available in release version 1.16.2.

@github-actions github-actions bot locked and limited conversation to collaborators Aug 7, 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. Language Service Visual Studio Inherited from Visual Studio
Projects
None yet
Development

No branches or pull requests

2 participants