test_common (test_common.cpp#L544, test_common.cpp#L551) and test_io (test_io.cpp#L793) occurs compile error on MSVC.
Error C2718 'Eigen::Vector4f': actual parameter with requested alignment of 16 won't be aligned test_common C:\pcl-1.8.0\test\common\test_common.cpp 544
Error C2718 'Eigen::Vector4f': actual parameter with requested alignment of 16 won't be aligned test_common C:\pcl-1.8.0\test\common\test_common.cpp 551
Error C2719 'p': formal parameter with requested alignment of 16 won't be aligned test_io C:\pcl-1.8.0\io\include\pcl\io\ascii_io.h 160
------ Build started: Project: test_common, Configuration: Debug Win32 ------
Building Custom Rule C:/pcl-1.8.0/test/common/CMakeLists.txt
CMake does not need to re-run because C:\pcl-1.8.0\build\test\common\CMakeFiles\generate.stamp is up-to-date.
test_common.cpp
C:\pcl-1.8.0\common\include\pcl/point_traits.h : warning C4819: The file contains a character that cannot be represented in the current code page (932). Save the file in Unicode format to prevent data loss
C:\pcl-1.8.0\test\common\test_common.cpp(544): error C2718: 'Eigen::Vector4f': actual parameter with requested alignment of 16 won't be aligned
C:\pcl-1.8.0\test\common\test_common.cpp(551): error C2718: 'Eigen::Vector4f': actual parameter with requested alignment of 16 won't be aligned
------ Build started: Project: test_io, Configuration: Debug Win32 ------
Building Custom Rule C:/pcl-1.8.0/test/io/CMakeLists.txt
CMake does not need to re-run because C:\pcl-1.8.0\build\test\io\CMakeFiles\generate.stamp is up-to-date.
test_io.cpp
C:\pcl-1.8.0\common\include\pcl/point_traits.h : warning C4819: The file contains a character that cannot be represented in the current code page (932). Save the file in Unicode format to prevent data loss
C:\pcl-1.8.0\io\include\pcl/io/ascii_io.h(160): error C2719: 'p': formal parameter with requested alignment of 16 won't be aligned
C:\pcl-1.8.0\test\io\test_io.cpp(793): note: see reference to function template instantiation 'void pcl::ASCIIReader::setInputFields<pcl::PointXYZI>(const PointT)' being compiled
with
[
PointT=pcl::PointXYZI
]
========== Build: 126 succeeded, 2 failed, 0 up-to-date, 0 skipped ==========
Compiler Error C2718 | MSDN Library
Compiler Error C2719 | MSDN Library
Please try to replace EXPECT_EQ in lines 544 and 551 with test::EXPECT_EQ_VECTORS. Also add #include <pcl/pcl_tests.h>.
So the second one looks weird. A method which takes an argument which is not used and then is casted into void (?). I'm not sure this one can be fixed without breaking the ABI.
Apparently the argument is needed only for the sake of automatic template type deduction. Cast to void is to avoid unused parameters warning.
Generally, point types should not be passed by value because of alignment, so this function signature is bad. Furthermore, the parameter is not really needed, one can specify point type explicitly. Therefore, I propose to deprecate this function, add parameter-less one, and use the latter in tests.
I have confirmed that test_common can build successfully when replace to test::EXPECT_EQ_VECTORS from EXPECT_EQ.
@UnaNancyOwen Can you file a PR with a fix for that and I'll file a different one for the deprecation and creation of the parameter-less method. I'll need you to give it a test once I submit it.
@SergioRAgostinho OK. I will send a PR.
Most helpful comment
Apparently the argument is needed only for the sake of automatic template type deduction. Cast to void is to avoid unused parameters warning.
Generally, point types should not be passed by value because of alignment, so this function signature is bad. Furthermore, the parameter is not really needed, one can specify point type explicitly. Therefore, I propose to deprecate this function, add parameter-less one, and use the latter in tests.