Fix compile with clang 16 and libc++#2242
Conversation
There was a problem hiding this comment.
About the first issue:
I think the root cause is the forward declaration of LogRecordExporter.
Because of std::unique_ptr<LogRecordExporter>, the compiler needs to see the LogRecordExporter destructor, and the header file that declares it.
Please try to include the header file for LogRecordExporter instead.
|
Per build logs in this PR: Please add the following two lines: and remove the matching forward declarations, Looks like unique_ptr is preventing to use forward declarations. |
The problem is
|
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #2242 +/- ##
=======================================
Coverage 87.34% 87.34%
=======================================
Files 169 169
Lines 4902 4902
=======================================
Hits 4281 4281
Misses 621 621
|
Independently of forwards, I agree that moving code from *.h to *.cc is a good change in general. My concern is that, even when this fix the immediate issue, there might be more cases where the use of forward declarations with std::unique_ptr causes problems (this is specific to unique_ptr, shared_ptr is working properly and does not need to see the destructor of T). Revising every forward used in every std::unique_ptr will be a separate change anyway, to analyze in more details, so approving this change. |
Fixes #2241
Changes
SimpleLogRecordProcessorinto.cc.std::vector::assignto replacestd::fill.For significant contributions please make sure you have completed the following items:
CHANGELOG.mdupdated for non-trivial changes