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

Problem with multiple template function instantiations on linux & mac #871

Closed
nwgh opened this issue Jul 6, 2017 · 10 comments
Closed

Problem with multiple template function instantiations on linux & mac #871

nwgh opened this issue Jul 6, 2017 · 10 comments
Labels
bug fixed Check the Milestone for the release in which the fix is or will be available. Language Service parser
Milestone

Comments

@nwgh
Copy link

nwgh commented Jul 6, 2017

I'm working on a codebase where I have a template member function of a class that is explicitly instantiated twice. Template definition is at https://searchfox.org/mozilla-central/rev/5e1e8d2f244bd8c210a578ff1f65c3b720efe34e/netwerk/protocol/http/Http2Session.cpp#676 with explicit instantiations a few lines down at https://searchfox.org/mozilla-central/rev/5e1e8d2f244bd8c210a578ff1f65c3b720efe34e/netwerk/protocol/http/Http2Session.cpp#707 and https://searchfox.org/mozilla-central/rev/5e1e8d2f244bd8c210a578ff1f65c3b720efe34e/netwerk/protocol/http/Http2Session.cpp#712

On both my mac and linux machines, I get the error function mozilla::net::Http2Session::CreateFrameHeader(charType dest, uint16_t frameLength, uint8_t frameType, uint8_t frameFlags, uint32_t streamID) [with charType=char *]" explicitly instantiated more than once twice (once for each instantiation, with the appropriate with charType bit for each line). This doesn't happen on my win10 machine using the same versions of everything. This is valid code that compiles on all 3 platforms without errors or warnings.

@sean-mcmanus
Copy link
Collaborator

sean-mcmanus commented Jul 7, 2017

Thanks for the bug report. We're able to repro it with just

class a
{
    template <typename c> void f(c in) {}
};

template void a::f(char in);

It looks like a bug with the clang mode of our compiler (it doesn't repro if the intelliSenseMode is set to msvc-x64 on Linux, and starts to repro on Windows if clang-x64 mode is used).

@spinicist
Copy link

Hi, just to note I am experiencing this problem as well on Mac (High Sierra).

@sean-mcmanus
Copy link
Collaborator

Another team was assigned this bug way back in July but they still haven't gotten around to fixing it. I'll try to ping them to see if they can increase the priority since we've been getting more complaints.

@sean-mcmanus
Copy link
Collaborator

Good news. Looks like we plan to get a fix by March or April.

@sean-mcmanus sean-mcmanus added this to the March 2018 milestone Feb 13, 2018
@sean-mcmanus sean-mcmanus self-assigned this Feb 14, 2018
@DABH
Copy link

DABH commented Feb 16, 2018

Anyone know if there's a way to disable/suppress this clang error/warning (maybe on a per-line or per-file basis, or even globally...) while we wait for a proper fix? (Either way, thanks for addressing this problem!)

@sean-mcmanus
Copy link
Collaborator

sean-mcmanus commented Feb 16, 2018

@DABH You could try hiding the code from our IntelliSense compiler via surrounding the code by #ifndef __INTELLISENSE__ #endif . You could also change the C_Cpp.errorSquiggles setting to "Disabled".

@bobbrow bobbrow added the parser label Feb 27, 2018
@bobbrow bobbrow added the fixed Check the Milestone for the release in which the fix is or will be available. label Mar 8, 2018
@sean-mcmanus
Copy link
Collaborator

sean-mcmanus commented Mar 23, 2018

The fix is in https://github.com/Microsoft/vscode-cpptools/releases/tag/v0.16.0-insiders2 if you want to try it out.

@spinicist
Copy link

Excellent! Now I have to read up how to get Insider builds.

@sean-mcmanus
Copy link
Collaborator

@spinicist "Download the .vsix that matches your OS and run the "Install from VSIX" command in VS Code.".

@spinicist
Copy link

Looks like it is fixed. Thanks!

@sean-mcmanus sean-mcmanus removed their assignment Apr 22, 2019
@github-actions github-actions bot locked and limited conversation to collaborators Oct 18, 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 parser
Projects
None yet
Development

No branches or pull requests

5 participants