Vscode-cpptools: Problem with multiple template function instantiations on linux & mac

Created on 6 Jul 2017  Â·  10Comments  Â·  Source: microsoft/vscode-cpptools

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.

Language Service bug fixed (release pending) parser

Most helpful comment

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

All 10 comments

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).

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

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.

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

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!)

@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".

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

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

Looks like it is fixed. Thanks!

Was this page helpful?
0 / 5 - 0 ratings