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

<typeinfo> must be included before typeid is used #1067

Closed
hypermagik opened this issue Sep 26, 2017 · 9 comments
Closed

<typeinfo> must be included before typeid is used #1067

hypermagik opened this issue Sep 26, 2017 · 9 comments
Labels
bug fixed Check the Milestone for the release in which the fix is or will be available. Language Service
Milestone

Comments

@hypermagik
Copy link

The following piece of code shows this error, even though typeinfo is included:

#include <typeinfo>

int main() {
    const std::type_info &ti = typeid(main);
    return 0;
}
file: 'file:///.../test.cpp'
severity: 'Error'
message: '<typeinfo> must be included before typeid is used'
at: '4,32'
source: ''

Operating System and version: Ubuntu 16.04.3 LTS.

VS Code version and if you are using the Insiders build: 1.16.1 (not Insiders build).

C/C++ extension version: 0.13.0.

Other extensions you installed and if the issue persists after disabling them: issue persists after disabling all other extensions.

Relevant settings from your settings.json, c_cpp_properties.json, and/or launch.json files:
"C_Cpp.intelliSenseEngine": "Default".

@sean-mcmanus
Copy link
Collaborator

Thanks for reporting it. It repros on Linux, but not Windows.

@ortix
Copy link

ortix commented Nov 14, 2017

This is also broken on macOS Sierra

@EECSGEEK
Copy link

This is also broken on Win-Platform

@sean-mcmanus
Copy link
Collaborator

@EECSGEEK The error shouldn't occur on Windows unless the typeinfo header (or a header it includes) fails to be located (or fails to get parsed). Are there other errors in your problems window?

@EECSGEEK
Copy link

EECSGEEK commented Nov 28, 2017

@sean-mcmanus

Program one(g++include cunistd.h)
(g++ compile is ok)

Program 2
But vscode [error]typeinfo must be included before typeid is used

My setting

@sean-mcmanus
Copy link
Collaborator

sean-mcmanus commented Nov 28, 2017

@EECSGEEK Oh, yeah, you're using mingw with clang-x64 mode -- that makes sense why it would behave like on Linux. The issue doesn't repro with the typeinfo header defined in the Windows SDK.

@sean-mcmanus
Copy link
Collaborator

sean-mcmanus commented Jan 8, 2018

I've verified the fix is in our pending update branch for February.

@sean-mcmanus sean-mcmanus added this to the February 2018 milestone Jan 8, 2018
@sean-mcmanus sean-mcmanus added the fixed Check the Milestone for the release in which the fix is or will be available. label Jan 8, 2018
@sean-mcmanus
Copy link
Collaborator

Fixed with the preview .vsix at https://github.com/Microsoft/vscode-cpptools/releases/tag/v0.15.0-insiders (our final release is planned for next week).

@sean-mcmanus
Copy link
Collaborator

@hypermagik @Ortix92 @EECSGEEK The bogus <typeinfo> must be included before typeid is used error has been fixed with 0.15.0. We're still aware of additional bogus errors that we have issues tracking that we plan to have fixes in the next couple months or so. If you notice a new issue, providing a repro will help us get a fix sooner. Thanks.

@github-actions github-actions bot locked and limited conversation to collaborators Oct 16, 2020
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
Projects
None yet
Development

No branches or pull requests

5 participants