You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
operator "" sv doesn't get recognized even though using namespace std::string_view_literals; is present #5681
Other extensions you installed (and if the issue persists after disabling them): Babel Javascript, CodeLLDB, PlatformIO IDE, PowerShell Preview, Python, IntelliCode. Issue persists after disabling all.
Does this issue involve using SSH remote to run the extension on a remote machine?: No
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).
Trying to use sv literal gives me an error user-defined literal operator not found even though using namespace std::string_view_literals is present, and the code does compile successfully. Using llvm-mingw toolchain
Steps to reproduce
Code for reproduction:
#include <string_view>
using namespace std::string_view_literals;
int main()
{
auto view = "test"sv;
return 0;
}
Expected behavior
The sv literal to be found in string_view
Logs
cpptools/getCodeActions: file:///g%3A/Code/C%2B%2B/test.cpp (id: 22)
cpptools/getCodeActions: file:///g%3A/Code/C%2B%2B/test2.cpp (id: 23)
cpptools/activeDocumentChange: file:///g%3A/Code/C%2B%2B/test2.cpp
cpptools/textEditorSelectionChange
cpptools/getDocumentSymbols: file:///g%3A/Code/C%2B%2B/test2.cpp (id: 24)
cpptools/getDocumentSymbols
cpptools/textEditorSelectionChange
cpptools/getFoldingRanges: file:///g%3A/Code/C%2B%2B/test2.cpp (id: 25)
idle loop: reparsing the active document
Checking for syntax errors: file:///g%3A/Code/C%2B%2B/test2.cpp
Queueing IntelliSense update for files in translation unit of: G:\CODE\C++\TEST2.CPP
cpptools/finishUpdateSquiggles
Error squiggle count: 1
Update IntelliSense time (sec): 0.263
Long Nguyen (@longnguyen2004)
Could you provide the logs from running "C/C++: Log Diagnostics"? It could be that the files from the toolchain that you're using is not getting included in the include path for IntelliSense configuration (or c_cpp_properties.json). If they are not included, could you try adding the toolchain path to the includePath property?
The correct include dir seems to be there, and VS Code do found the string_view file (confirmed by right-clicking and Go to Definition), the literal just doesn't get picked up.
I also found this when I was looking through string_view, seems to be related to #1083 (comment)
I don't think think we've ever tested (or have had user reports of) the llvm-mingw toolchain yet. You may want to try changing your IntelliSense mode to clang-x86.
I believe the fix for the "dirty hack" is #5258 (comment), i.e. to auto-detect the x86 IntelliSense mode based on the results from querying the compiler.
Activity
michelleangela commentedon Jun 23, 2020
Long Nguyen (@longnguyen2004)
Could you provide the logs from running "C/C++: Log Diagnostics"? It could be that the files from the toolchain that you're using is not getting included in the include path for IntelliSense configuration (or c_cpp_properties.json). If they are not included, could you try adding the toolchain path to the includePath property?
longnguyen2004 commentedon Jun 24, 2020
Log Diagnostics:
The correct include dir seems to be there, and VS Code do found the

string_viewfile (confirmed by right-clicking and Go to Definition), the literal just doesn't get picked up.I also found this when I was looking through
string_view, seems to be related to #1083 (comment)sean-mcmanus commentedon Jun 24, 2020
I don't think think we've ever tested (or have had user reports of) the llvm-mingw toolchain yet. You may want to try changing your IntelliSense mode to clang-x86.
longnguyen2004 commentedon Jun 25, 2020
clang-x86 seems to work, although it's kinda a dirty hack imo, but I'm happy with it. You can close this now
sean-mcmanus commentedon Jun 25, 2020
I believe the fix for the "dirty hack" is #5258 (comment), i.e. to auto-detect the x86 IntelliSense mode based on the results from querying the compiler.