Skip to content

fix: define NFC-A destructors out of line#6

Open
Sped0n wants to merge 1 commit into
m5stack:developfrom
Sped0n:fix-nfca-out-of-line-destructor
Open

fix: define NFC-A destructors out of line#6
Sped0n wants to merge 1 commit into
m5stack:developfrom
Sped0n:fix-nfca-out-of-line-destructor

Conversation

@Sped0n
Copy link
Copy Markdown

@Sped0n Sped0n commented May 25, 2026

Problem

NFCLayerA owns a std::unique_ptr<Adapter>, but Adapter is only forward-declared when the compiler sees the implicit inline destructor for NFCLayerA.

This can trigger incomplete-type diagnostics in clangd:

In included file: invalid application of 'sizeof' to an incomplete type 'm5::nfc::NFCLayerA::Adapter' [sizeof_alignof_incomplete_or_sizeless_type]
unique_ptr.h:91:16: Error occurred here
unique_ptr.h:398:4: In instantiation of member function 'std::default_delete<m5::nfc::NFCLayerA::Adapter>::operator()' requested here
nfc_layer_a.hpp:43:7: In instantiation of member function 'std::unique_ptr<m5::nfc::NFCLayerA::Adapter>::~unique_ptr' requested here
nfc_layer_a.hpp:43:7: In implicit destructor for 'm5::nfc::NFCLayerA' first required here
nfc_layer_a.hpp:45:12: Forward declaration of 'm5::nfc::NFCLayerA::Adapter'

The same ownership pattern exists in EmulationLayerA.

Change Overview

  • Declare destructors for NFCLayerA and EmulationLayerA in their headers.
  • Define both destructors out-of-line in their .cpp files.

Testing

Tested on CoreS3 with Unit NFC: platformio test -e test_UnitNFC_CoreS3 --upload-port /dev/ttyACM0 --test-port /dev/ttyACM0, 145/145 test cases passed.

Signed-off-by: Zhibin (Ryan) Wen <wenzhibin@espressif.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant