Xilinx / embeddedsw

Xilinx Embedded Software (embeddedsw) Development
Other
926 stars 1.06k forks source link

C++ compilation error because of uninitialized const member #132

Open elodg opened 4 years ago

elodg commented 4 years ago

Instantiating XDpPsu from xdppsu.h in a C++ project results in the following errors:

use of deleted function 'XDpPsu::XDpPsu()'
use of deleted function 'XDpPsu_MainStreamAttributes::XDpPsu_MainStreamAttributes()'
use of deleted function 'XVidC_VideoTimingMode::XVidC_VideoTimingMode()'
uninitialized const member in 'struct XVidC_VideoTimingMode'
'const char XVidC_VideoTimingMode::Name [21]' should be initialized

The issue is that XDpPsu_MainStreamAttributes struct includes XVidC_VideoTimingMode struct as a member variable by value, whereas XVidC_VideoTimingMode is meant to be used as a pointer to a constant element in a timing array. XVidC_VideoTimingMode cannot be default-constructed because its const char Name[21] is not initialized.

https://github.com/Xilinx/embeddedsw/blob/338150ab3628a1ea6b06e964b16e712b131882dd/XilinxProcessorIPLib/drivers/dppsu/src/xdppsu.h#L140

vsrik commented 4 years ago

Thanks. We will fix it in our next release.