-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Nested namespaces (or C++1z) support #699
Comments
What type of support are you looking for from VS Code? What feature is not working correctly? Are you referring to C++11 inline namespaces? |
Consider the following code piece: namespace my::nested::space {
class some_class {
...
};
} In C++17, this is a valid definition of a nested namespace. Currently, VSC with cpptools will throw the following error at the first line of this snippet:
... and of course I'm not able to autocomplete this namespace, nor the class name. I guess VSC should be able to properly recognize this as a valid syntax, and properly detect I'm not sure if this is something that is implemented inside the cpptools or provided by an external tool (like clang), but I hope this clarifies what I was trying to "achieve". |
The C++17 nested namespace feature doesn't even work with the Visual Studio 2017 IntelliSense, although the cl.exe compiler seems to support it. Our goal is to support C++17, but currently our level of support is around C++14. I'm not sure yet what the timeframe is. |
My previous statement is incorrect. Nested namespace definitions work in VS 2017 when the /std:c++latest compile flag is used, and it works in VS Code on Windows -- I'm reproing the error you're seeing on Linux. So it looks like a bug. |
The bug is "fixed" by adding |
@sean-mcmanus Thank you for your response. I can confirm that this quick "fix" allowed me to use nested namespaces. However (just a note for other people struggling with the same problem), I had to apply this change to the
(previous value of I'll test that out and report any problems once found. |
Using "c++latest" as described should not work -- hovering should give an error message about "No IL available". It probably looks like it worked because the error disappeared because the invalid flag causes the errors to go away. Can you try the other |
At first, I've applied only the Btw, I forgot to mention that I'm using VSCode Insiders, here is the exact version number:
|
Yeah, I was mistaken. For some strange reason, simply adding a comma to the end of the "defaults" list causes it to become "fixed" (not the "-D_MSC_EXTENSIONS" mentioned earlier, e.g. |
Simply placing |
Okay, you're right, I'm able to repro the problem with vector. We need to investigate further why this is working on Windows and not Linux. |
Changing |
I can confirm it works as expected (this time, introducing any kind of error in other places of the code properly displays that, so the language server works fine). Thank you for your response and investigation. |
This was fixed in version 0.11.1. Please reopen if you continue to have this issue. |
Hi, I'm currently trying to configure VSCode to "support" nested namespaces in C++ code. My code builds just fine when using clang++ (ver. 3.8.0) with flag
-std=c++1z
, so the only thing I need is working code completion inside VSC itself.Is there a way to enable VSCode to use that "experimental" standard by switching some kind of configuration flag, or is this currently out of scope?
The text was updated successfully, but these errors were encountered: