[Lldb-commits] [PATCH] D70830: [LLDB] Disable MSVC warning C4190

Martin Storsjö via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Thu May 6 14:30:28 PDT 2021


mstorsjo added a comment.

Just for the record, the issue seems to be this:

  $ cat cpp-ret-c.cpp 
  template<class T> class MyClass {
  public:
      T a;
  };
  extern "C" MyClass<int> unmangledFunction();
  $ cl -c cpp-ret-c.cpp 
  cpp-ret-c.cpp
  cpp-ret-c.cpp(5): error C2526: 'unmangledFunction': C linkage function cannot return C++ class 'MyClass<int>' 
  cpp-ret-c.cpp(5): note: see declaration of 'MyClass<int>'
  $ cat cpp-ret-c2.cpp 
  template<class T> class MyClass {
  public:
      T a;
  };
  MyClass<int> unusedFunc() { return MyClass<int>{0}; }
  extern "C" MyClass<int> unmangledFunction();
  $ cl -c cpp-ret-c2.cpp
  cpp-ret-c2.cpp

So this construct, in MSVC, requires that the problematic return type template already has been instantiated somewhere else first. The case in the python plugin works, but it has been copied to the Lua plugin too, where it fails.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D70830/new/

https://reviews.llvm.org/D70830



More information about the lldb-commits mailing list