Llvm reports an error declared with incompatible types in different translation units

I am trying to debug a C ++ OS X application in Xcode 5.1 (5B130a) under OS X 10.9.2. The application consists of various library projects that are compiled into libraries and are used in the main application project.

I set a breakpoint in my code and when I started lldb:

expr 2 

here is what i get:

  (lldb) expr 2 error: field '__f_' declared with incompatible types in different translation units ('__base *' (aka 'std::__1::__function::__base<void (std::__1::shared_ptr<const XXX>, const YYY &)> *') vs. '__base *' (aka 'std::__1::__function::__base<void> *')) error: field '__f_' declared with incompatible types in different translation units ('__base *' (aka 'std::__1::__function::__base<void (std::__1::shared_ptr<const XXX>, const YYY &)> *') vs. '__base *' (aka 'std::__1::__function::__base<void> *')) error: expected expression note: declared here with type '__base *' (aka 'std::__1::__function::__base<void> *') note: declared here with type '__base *' (aka 'std::__1::__function::__base<void> *') error: 3 errors parsing expression 

Note that if I set a breakpoint elsewhere in the code, this same command may work (but not everywhere). This makes me think that the particular library that I am breaking matters.

I understand that somewhere there is a definition for std::function<void(std::shared_ptr<const XXX>, const YYY&)> and that some other translation unit sees it with a different definition (I assume that __f_ is the internal field of the template is std :: function templated), however this is not clear to me:

  • Why doesn't the replicator complain about this? (in fact, the application works fine)
  • what code generation switch mismatch can this cause? I already checked GCC_OPTIMIZATION_LEVEL (all -O0 ), COPY_PHASE_STRIP , ...

Thanks!

0
source share
1 answer

Most likely, this is a problem with debugging information, and not with the generated code, so your application works correctly, but the expression analyzer in the debugger does not work.

The debugger always tries to read the least amount of debugging information that it needs in order to do whatever you ask. Therefore, until you do something that forces us to read in two modules that do not agree with the debugging information, you will not see this problem. This is why it sometimes happens, and sometimes not.

In any case, please report a bug using bugreporter.apple.com.

0
source

All Articles